From: Milind G. <mil...@gm...> - 2012-08-31 05:19:33
|
Thanks Yes AddPendingEvent scheme worked. I am getting the scroll bar position from the window Regards, Milind On Thu, Aug 30, 2012 at 8:46 PM, John Labenski <jla...@gm...> wrote: > On Wed, Aug 29, 2012 at 2:48 PM, Milind Gupta <mil...@gm...> > wrote: > > Hi, > > I have 2 wxGrid windows side by side and I want to synchronize > the > > scroll on the 2 windows. The scroll event works fine but when I read the > > scroll position of the window and set the scroll on the other window it > does > > not sync up. There is a lag. It seems that the actual scroll happens > after > > my event handler is processed so my other window always gets to the > position > > where the 1st one was before. > > Where are you getting the scroll position from? The event or the > window itself? You should compare the two. > > > Is there a way to let the scroll happen and then read the scroll > position? > > The wxWidgets forum said that there is a hidden function called > > HandleOnScroll, which I tried but it does not work in wxLua. Is there any > > other way? > > If you want to process something after an event comes, create a new > event with whatever event type you want and a unique id you can use to > discriminate it and add it as a pending event to be sent after the > current event is handled. > > local updateEvent = wx.wxCommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, > ID_REFRESH_GRID_SCROLL); > mywindow:GetEventHandler():AddPendingEvent(updateEvent); > > then when you get this event in your handler for it, sync the scrollbars. > > Regards, > John > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users > |