Page 1 of 1
Bug in Linux version?
Posted: Thu Feb 27, 2025 6:18 pm
by tua
Code: Select all
EnableExplicit
Procedure TabChanged()
Debug GetGadgetState(1)
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget (1, 10, 10, 780, 580)
AddGadgetItem (1, -1, "First")
AddGadgetItem (1, -1, "Second")
CloseGadgetList()
BindGadgetEvent(1, @TabChanged(), #PB_EventType_Change)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Under Windows, clicking on the 2nd tab gives me the expected 1. On Ubuntu, I get 0 which I believe to be wrong, as the help states that a change event has occurred and now the current tab should be the second tab.
Can anyone confirm?
Re: Bug in Linux version?
Posted: Thu Feb 27, 2025 6:49 pm
by PeDe
Re: Bug in Linux version?
Posted: Thu Feb 27, 2025 6:57 pm
by mk-soft
This is already known. Under Linux, the data is updated a little too late.
Solution with one event later ...
Code: Select all
EnableExplicit
Procedure TabChanged()
If EventData() = $FFFF ;
Debug GetGadgetState(1)
Else
PostEvent(#PB_Event_Gadget, EventWindow(), EventGadget(), EventType(), $FFFF)
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget (1, 10, 10, 780, 580)
AddGadgetItem (1, -1, "First")
AddGadgetItem (1, -1, "Second")
CloseGadgetList()
BindGadgetEvent(1, @TabChanged(), #PB_EventType_Change)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Bug in Linux version?
Posted: Mon Mar 03, 2025 6:34 am
by PeDe
Hello mk-soft,
until now, I assumed that the bind/post-event functions are processed completely within PB. But apparently the functions are also dependent on the operating system. I don't understand the difference between the normal EventLoop, where the correct index is immediately available, and the delayed BindEvent.
Do you have more information on how this works internally in PB? Or is this pointless because it possibly only affects the panel gadget?
Peter
Re: Bug in Linux version?
Posted: Mon Mar 03, 2025 9:14 am
by Fred
Event are only processed when Wait/WindowEvent() is called. A binded event will be called during this call (ie: the Wait/WindowEvent() call won't return until all binded event have been processed). So yes, it's kind of OS dependent as you need to execute the event processing. In this case, it's a bug as we should update the PB internal vars before calling the callback.