Another Linux panel bug?

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

Another Linux panel bug?

Post by tua »

Can someone confirm?

Code: Select all

EnableExplicit

Procedure Main()
  If OpenWindow(0, 0, 0, 400, 400, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected tsw, tsh
    
    PanelGadget(1, 10, 10, 380, 380)
       AddGadgetItem (1, -1, "Panel 1")  
       AddGadgetItem (1, -1, "Panel 1")  
       tsw = GetGadgetAttribute(1,  #PB_Panel_ItemWidth)   ; broken under linux - both come back as 0
       tsh = GetGadgetAttribute(1,  #PB_Panel_ItemHeight)  ; works fine under windows
       Debug Str(tsw) + #LF$ + Str(tsh)                                                                 
    CloseGadgetList()   
  EndIf     
EndProcedure
   
Main()   
     
Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
User avatar
moulder61
Enthusiast
Enthusiast
Posts: 205
Joined: Sun Sep 19, 2021 6:16 pm
Location: U.K.

Re: Another Linux panel bug?

Post by moulder61 »

Hi tua,

I just tried it on Void Linux using PB6.11 LTS beta 2 and they both come back as 1. Presumably they should both be 380?
I tried commenting out one of the panel gadgets and then renaming one of the panels, in case it made a difference but it was the same result.

Moulder.
"If it ain't broke, fix it until it is!

This message is brought to you thanks to SenselessComments.com

My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
tua
User
User
Posts: 68
Joined: Sun Jul 23, 2023 8:49 pm
Location: BC, Canada

Re: Another Linux panel bug?

Post by tua »

My bad - I also get 1, not 0.

Under Windows 11 PB returns 374 & 353 (accounting for borders and the header tab)
User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Another Linux panel bug?

Post by mk-soft »

This is not because of PureBasic, but because GTK internally builds the window asynchronously.

Trick solution

Code: Select all

EnableExplicit

Procedure Main()
  If OpenWindow(0, 0, 0, 400, 400, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected tsw, tsh
    
    PanelGadget(1, 10, 10, 380, 380)
    AddGadgetItem (1, -1, "Panel 1")  
    AddGadgetItem (1, -1, "Panel 2")  
    CloseGadgetList()
    
    ; Wait asynchrone GTK is ready
    While GetGadgetAttribute(1,  #PB_Panel_TabHeight) <= 0
      Delay(10)
    Wend
    
    tsw = GetGadgetAttribute(1,  #PB_Panel_ItemWidth)   ; broken under linux - both come back as 0
    tsh = GetGadgetAttribute(1,  #PB_Panel_ItemHeight)  ; works fine under windows
    Debug Str(tsw) + #LF$ + Str(tsh)                                                                 
    
  EndIf     
EndProcedure

Main()   

Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
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
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Another Linux panel bug?

Post by Fred »

Yes, it's an annoyance of GTK. QT is better regarding this
User avatar
NicTheQuick
Addict
Addict
Posts: 1527
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Another Linux panel bug?

Post by NicTheQuick »

Fred wrote: Tue Mar 04, 2025 12:03 pm Yes, it's an annoyance of GTK. QT is better regarding this
Do you know of a better way to wait for the asynchron window rendering?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Another Linux panel bug?

Post by Fred »

GTK provide a 'realize' event where you're supposed to wait before doing GUI manipulation, but it doesn't fit the PB model at all. We could may be approximate the innerheight/width of panel gadget somehow while the UI isn't really rendered, but it's more an hack than a solution
Post Reply