Bug in Linux version?

Just starting out? Need help? Post your questions and find answers here.
tua
User
User
Posts: 68
Joined: Sun Jul 23, 2023 8:49 pm
Location: BC, Canada

Bug in Linux version?

Post 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?
PeDe
Enthusiast
Enthusiast
Posts: 305
Joined: Sun Nov 26, 2017 3:13 pm

Re: Bug in Linux version?

Post by PeDe »

User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Bug in Linux version?

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PeDe
Enthusiast
Enthusiast
Posts: 305
Joined: Sun Nov 26, 2017 3:13 pm

Re: Bug in Linux version?

Post 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
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Bug in Linux version?

Post 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.
Post Reply