Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

EnsureVisible Method

I'm having trouble with the EnsureVisible Method. It will change the date on the control, but will not scroll down to the appointment that was passed as the ID. The view will always stay at the top of the timeline after calling this method. I can even scroll down to the appointment to put it in view, and calling this method will result in resetting back to the top most (earliest) time on the timeline. Could this be a glitch in the method? I'm using version 4.1.0 RC7.

Comments

  • I'm not aware of a glitch in this method. In fact, I use it myself with a specific project I support that utilizes this control heavily. I am using 4.1.0 RC11. I can provide you a newer version of the control if you want to see if that helps, but I guessing there is something with your configuration that could be interfering. We might need you to provide us with a code snippet of your setup so we can test in-house.

    There is something else I would like you to try. After calling the EnsureVisible method set the SelAppt property to the same ID. Does that change anything?
  • Just to add a little more information, I upgraded to the latest build of SRPControls and I'm getting the same result. I noticed that the scroll bar on the right indicates with the shading that it is showing the bottom of the visible timeline, but what is really visible is the top of the timeline. If I click on the down arrow of the right scroll bar, then it immediately shows the bottom part of the timeline as the shading indicates in the scroll bar. In other words, what is visible is out of sync with the scroll bar right after this method is called. Are any of you seeing this behavior also?
  • I changed the SelAppt property to the same ID after the EnsureVisible method and nothing changed.
  • No, I'm not seeing that. When you say, "upgraded to the latest build" what version is that? Are you referring to the latest official release (v4.0.3)?
  • Yes, downloaded from the website.
  • Okay. I guess you were wondering if downgrading would help under the assumption that your issue was newly introduced. Given that didn't change anything, your best bet is to upgrade to 4.1.0 RC12 or just put together an RDK that duplicates your setup so we can test this in-house.
  • I haven't used the schedule control yet, so this isn't a situation where it was working with a previous version of the control. I simply have not been able to get the EnsureVisible method to work other than I have described above. To make sure there isn't something else affecting it, I made a new form in a copy of a Frameworks app. I put the example code from the wiki in the WINDOW.CREATE event to setup up the Entities and Appointments, which creates a load of random appointments over several entities. I placed an edit line and push button on the form, so I could type in an appointment ID and click the button. On that CLICK event I place the following lines of code:

    Event PUB_ENSURE_VISIBLE.CLICK() ApptId = Get_Property(@Window:".EDL_ENSURE_VISIBLE", "TEXT") rv = Send_Message(@Window:".OLE_SCHEDULE", "OLE.EnsureVisible", ApptId) Set_Property(@Window:".OLE_SCHEDULE", "OLE.SelAppt", ApptId) end event

    I am seeing the exact same behavior that I described before on this form also, where it will move to the correct date, but only show the topmost part of the timeline. If I scroll down to put the event in view and then push the button again, it will move the view to the top of the timeline again.

    My OI license doesn't include the ability to create an RDK, so I don't have a way to send you the code. Not sure if you have any other thoughts on how I can fix this.
  • Here is a copy of the setup of the SRP Schedule control to help you see if you can duplicate the same behavior.

    Event WINDOW.CREATE(CreateParam) Gosub SetupSchedule End Event SetupSchedule: Declare function Min, Max // Create Entities Desc = "Treat this like a subheading." Data = "" Data<-1> = "GRP" :@VM: 1 :@VM: "GroupKey1" :@VM: "Main Group 1" :@VM: Desc Data<-1> = "ENT" :@VM: 2 :@VM: "EntityKey1-1" :@VM: "Entity 1" :@VM: Desc Data<-1> = "ENT" :@VM: 2 :@VM: "EntityKey1-2" :@VM: "Entity 2" :@VM: Desc Data<-1> = "GRP" :@VM: 1 :@VM: "GroupKey2" :@VM: "Main Group 2" :@VM: Desc Data<-1> = "ENT" :@VM: 2 :@VM: "EntityKey2-1" :@VM: "Entity 3" :@VM: Desc Data<-1> = "GRP" :@VM: 2 :@VM: "GroupKey2-1" :@VM: "Sub Group" :@VM: Desc Data<-1> = "ENT" :@VM: 3 :@VM: "EntityKey2-1-1" :@VM: "Entity 4" :@VM: Desc Data<-1> = "ENT" :@VM: 3 :@VM: "EntityKey2-1-2" :@VM: "Entity 5" :@VM: Desc Set_Property(@Window:".OLE_SCHEDULE", "OLE.EntityList", Data) Desc = "This is a long description of the appointment, which contains very important details" ForeColor = "RGB{255, 255, 255}" // Give all appointments a lead time of 60 minutes LeadTime = 0.041667 // Create random appointments for the next 30 days Appts = "" ID = 0 For i = 1 to 30 Count = 0 CurrDate = Date() + i GoSub Get_Random_Data Appts<-1> = "EntityKey1-1":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey1-2":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey2-1":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey2-1-1":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey2-1-1":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey2-1-2":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Appts<-1> = "EntityKey2-1-2":@VM:ID:@VM:StartTime:@VM:EndTime:@VM:BackColor:@VM:ForeColor:@VM:"Appt ":Count:@VM:Desc:@VM:LeadTime Count = Count + 1; ID = ID + 1 GoSub Get_Random_Data Next i // Add the appointments Set_Property(@Window:".OLE_SCHEDULE", "OLE.AppointmentList", Appts) return Get_Random_Data: // Generate random times Time1 = Rnd( 48 ) * 1800 Time2 = Rnd( 48 ) * 1800 // Convert to OI Internal DT format StartTime = IConv(OConv(CurrDate - Rnd(2), "D4/") : " " : OConv(Min(Time1, Time2), "MTS"), "DT") EndTime = IConv(OConv(CurrDate, "D4/") : " " : OConv(Max(Time1, Time2), "MTS"), "DT") // Generate random back color BackColorHue = Rnd(256) BackColor = "HSL{":BackColorHue:", 127, 45}" return
  • I think this should be enough for us to test with. We'll get back to you ASAP. Thank you very much for posting the code.
Sign In or Register to comment.