From: John L. <jla...@gm...> - 2012-08-31 03:46:12
|
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 |