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
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?
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.
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