ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Linux specific forum
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

Hi GTK gurus
I just re- compiled my app for (again) testing on Linux, which was resizing fine few months ago on all sorts of Linux OS.
Every window with a toolbar now returns around double the height of the toolbar, so any Gadgets placed directly under the bottom of the toolbar are
good 25 pixels (or more) lower, than they should be, thus the whole layout moves down.
The same code works on older Raspberry, Windows and Mac (is pixel exact in all cases)
This seems to happen since about a month after updates on Ubuntu 20, Elementary OS 7.1, Kubuntu 20 and 22 and several others.

I checked, that GTK uses standard Themes - Awaita or Adwaita Dark, so the theme should not be an issue (other GTK apps seem fine)

Any idea, what could cause the problem?
The code is standard - toolbar, few string gadgets below and Menu
Resizing vertically is done by simply adding height + small offset.
There is no issue with horizontal sizing.
S.T.V.B.E.E.V.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by mk-soft »

I have to update my Ubuntu 20.04 first.
Not started for a long time.
Which PB version ?
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
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

PB 6.04 -did not change.

Here is the code of the screen UI only (sorry that it is a lot, but I prefer to have it more or less identical, not a mock up)

Code: Select all

Enumeration MenuItemsAddress 
  #Menu_Addr_New = 1487
  #Menu_Addr_Delete
  #Menu_Addr_Save
  #Menu_Addr_Close
  #Menu_Addr_SortF
  #Menu_Addr_SortL
  #Menu_Addr_RefreshList
  #Menu_Addr_Search
  #AddressDoSearch
  #Menu_Addr_SortC
  #Menu_Addr_AssignComp
  #Menu_SsendmailTo
  #Menu_Addr_SelectAll
  #Menu_Addr_AssignAcc
EndEnumeration  

Global Window_ResizeTest_ToolBarImageList
Global Window_ResizeTest
Global Window_ResizeTest_MainMenu
Global Window_ResizeTest_ToolBar
Global Window_ResizeTest_StatusBar

Global Window_ResizeTest_lblfind
Global Window_ResizeTest_TxtSearch
Global Window_ResizeTest_Imgbtn_ClearSearch
Global Window_ResizeTest_Text_1
Global Window_ResizeTest_lblAdresAs
Global Window_ResizeTest_FirstName
Global Window_ResizeTest_txtAdresAs
Global Window_ResizeTest_ListAddresses
Global Window_ResizeTest_Text_1_1
Global Window_ResizeTest_LblCompany
Global Window_ResizeTest_LastName
Global Window_ResizeTest_txtCompany
Global Window_ResizeTest_lblEmlAddrt
Global Window_ResizeTest_lblEmlAddrAlias
Global Window_ResizeTest_TxtAddremoveEmail
Global Window_ResizeTest_TxtAddEmlAlias
Global Window_ResizeTest_AddrUpdateEmail
Global Window_ResizeTest_AddEmail
Global Window_ResizeTest_RemoveEmail
Global Window_ResizeTest_ListEmailsPerson
Global Window_ResizeTest_Phoneslbl
Global Window_ResizeTest_ComboCommTypes
Global Window_ResizeTest_TxtAddremovePhone
Global Window_ResizeTest_AddrUpdatePhone
Global Window_ResizeTest_AddCommunication
Global Window_ResizeTest_RemoveCommunication
Global Window_ResizeTest_ListPhonesPerson

Procedure Menu_Window_ResizeTest()
  
  Window_ResizeTest_MainMenu = CreateMenu(#PB_Any, WindowID(Window_ResizeTest))

  CTRLShortcut.s = Chr(9)
  
If Window_ResizeTest_MainMenu
MenuTitle("Address")
  MenuItem(#Menu_Addr_New, "New" + CTRLShortcut + "N")
  MenuItem(#Menu_Addr_Delete, "Delete" + CTRLShortcut + "D")
  MenuItem(#Menu_Addr_Save, "Save" + CTRLShortcut + "S")
  MenuBar()
  MenuItem(#Menu_SsendmailTo, "Send Email" + CTRLShortcut + "E")
  MenuBar()
  MenuItem(#Menu_Addr_Close, "Close" + CTRLShortcut + "Q")
  MenuTitle("Sort")
  MenuItem(#Menu_Addr_SortF, "First Name")
  MenuItem(#Menu_Addr_SortL, "Last Name")
  MenuItem(#Menu_Addr_SortC, "Company")
  MenuBar()
  MenuItem(#Menu_Addr_RefreshList, "Refresh" + Chr(9) + "F5")
MenuTitle("Tools")  
Define i.i = 0
MenuItem(#Menu_Addr_AssignAcc, "Set All Unassigned Emails to Main Account")

  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_F5, #Menu_Addr_RefreshList)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_S, #Menu_Addr_Save)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_Q, #Menu_Addr_Close)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_N, #Menu_Addr_New)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_E, #Menu_SsendmailTo)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_D, #Menu_Addr_Delete)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_F, #Menu_Addr_Search)
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Return, #AddressDoSearch)
  
  AddKeyboardShortcut(Window_ResizeTest, #PB_Shortcut_Command | #PB_Shortcut_A, #Menu_Addr_SelectAll)
EndIf
SetMenuItemState(Window_ResizeTest_MainMenu, #Menu_Addr_SortF,1)
EndProcedure


Procedure ToolBar_Window_ResizeTest()
  UsePNGImageDecoder()
  Window_ResizeTest_ToolBar = CreateToolBar(#PB_Any, WindowID(Window_ResizeTest), #PB_ToolBar_Large | #PB_ToolBar_Text ) ;
  Img_New24 =LoadImage(#PB_Any, #PB_Compiler_Home + "examples/sources/Data/ToolBar/New.png")
  Img_trash24 = LoadImage(#PB_Any,#PB_Compiler_Home + "examples/sources/Data/ToolBar/Delete.png")
  Img_Save24 = LoadImage(#PB_Any,#PB_Compiler_Home + "examples/sources/Data/ToolBar/Save.png")
  Img_sendbig = LoadImage(#PB_Any,#PB_Compiler_Home + "examples/sources/Data/ToolBar/Undo.png")
  
  If Window_ResizeTest_ToolBar
    ToolBarImageButton(#Menu_Addr_New, ImageID(Img_New24),#PB_ToolBar_Normal, "Add New")
    ToolBarImageButton(#Menu_Addr_Delete, ImageID(Img_trash24),#PB_ToolBar_Normal, "Delete")
    ToolBarImageButton(#Menu_Addr_Save, ImageID(Img_Save24),#PB_ToolBar_Normal, "Save")
    ToolBarSeparator()
    ToolBarImageButton(#Menu_SsendmailTo, ImageID(Img_sendbig),#PB_ToolBar_Normal, "Email")
  EndIf
EndProcedure

Procedure StatusBar_Window_ResizeTest()
Window_ResizeTest_StatusBar = CreateStatusBar(#PB_Any, WindowID(Window_ResizeTest))
If Window_ResizeTest_StatusBar
AddStatusBarField(#PB_Ignore)
AddStatusBarField(150)
StatusBarText(Window_ResizeTest_StatusBar, 0, "Address Book")
StatusBarText(Window_ResizeTest_StatusBar, 1, " ", #PB_StatusBar_Center)
EndIf
EndProcedure

Procedure ResizeLists()
  
  Protected lvw = GadgetWidth(Window_ResizeTest_ListPhonesPerson)
  Protected tw = lvw - 190 -36
  SetGadgetItemAttribute(Window_ResizeTest_ListPhonesPerson,0, #PB_ListIcon_ColumnWidth, tw,2)
  
  lvw = GadgetWidth(Window_ResizeTest_ListEmailsPerson)
  tw = lvw - 280 -36
  SetGadgetItemAttribute(Window_ResizeTest_ListEmailsPerson,0, #PB_ListIcon_ColumnWidth, tw,2)
  
EndProcedure  
  
Procedure Resize_Window_ResizeTest()

    Protected xc,yc,wc,hc
    Protected ScaleX.f, ScaleY.f
    Static MenuHeight, ToolBarHeight, StatusBarHeight
    Static Window_ResizeTest_WidthIni, Window_ResizeTest_HeightIni
    If MenuHeight + ToolBarHeight + StatusBarHeight = 0
      CompilerSelect #PB_Compiler_OS
        CompilerCase #PB_OS_MacOS
            MenuHeight = 0
          CompilerDefault
            MenuHeight = MenuHeight() 
      CompilerEndSelect
      ToolBarHeight = ToolBarHeight(Window_ResizeTest_ToolBar) 
      StatusBarHeight = StatusBarHeight(Window_ResizeTest_StatusBar)
    EndIf
    If Window_ResizeTest_WidthIni = 0
      Window_ResizeTest_WidthIni = WindowWidth(Window_ResizeTest,#PB_Window_InnerCoordinate) 
      Window_ResizeTest_HeightIni = WindowHeight(Window_ResizeTest,#PB_Window_InnerCoordinate) - MenuHeight - ToolBarHeight - StatusBarHeight
    EndIf
    
    Protected winw, winh
    winw =  WindowWidth(Window_ResizeTest,#PB_Window_InnerCoordinate) 
    winh =  WindowHeight(Window_ResizeTest,#PB_Window_InnerCoordinate)
     
      ScaleX = winw / Window_ResizeTest_WidthIni 
      ScaleY = (winh - MenuHeight - ToolBarHeight - StatusBarHeight) / Window_ResizeTest_HeightIni
      Protected StdH = 26 ; do not allow edits to be too tall
      
    ResizeGadget(Window_ResizeTest_lblfind, ScaleX * 10, ToolBarHeight + ScaleY * (54 - ToolBarHeight), ScaleX * 60, StdH)
    ResizeGadget(Window_ResizeTest_TxtSearch, ScaleX * 80, ToolBarHeight + ScaleY * (54 - ToolBarHeight), ScaleX * 370, StdH)
    ResizeGadget(Window_ResizeTest_Imgbtn_ClearSearch, ScaleX * 460, ToolBarHeight + ScaleY * (54 - ToolBarHeight),  StdH,  StdH)
    ResizeGadget(Window_ResizeTest_Text_1, ScaleX * 500, ToolBarHeight + ScaleY * (54 - ToolBarHeight), ScaleX * 100, StdH)
    ResizeGadget(Window_ResizeTest_lblAdresAs, ScaleX * 800, ToolBarHeight + ScaleY * (54 - ToolBarHeight), ScaleX * 100, ScaleY * 20)
    ResizeGadget(Window_ResizeTest_FirstName, ScaleX * 510, ToolBarHeight + ScaleY * (74 - ToolBarHeight), ScaleX * 260, StdH)
    ResizeGadget(Window_ResizeTest_txtAdresAs, ScaleX * 810, ToolBarHeight + ScaleY * (74 - ToolBarHeight), ScaleX * 250, StdH)
    
    Protected listh.i 
    listh = winh  
    listh = listh - ToolBarHeight 
    listh = listh - (GadgetY(Window_ResizeTest_TxtSearch) + GadgetHeight(Window_ResizeTest_TxtSearch))
    listh = listh - 1

    ResizeGadget(Window_ResizeTest_ListAddresses, ScaleX * 10, ToolBarHeight + ScaleY * (84 - ToolBarHeight), ScaleX * 475, listh) ; ScaleY * 634  + ScaleY * offset
    ResizeGadget(Window_ResizeTest_Text_1_1, ScaleX * 500, ToolBarHeight + ScaleY * (104 - ToolBarHeight), ScaleX * 150, StdH)
    ResizeGadget(Window_ResizeTest_LblCompany, ScaleX * 800, ToolBarHeight + ScaleY * (104 - ToolBarHeight), ScaleX * 110, StdH)
    ResizeGadget(Window_ResizeTest_LastName, ScaleX * 510, ToolBarHeight + ScaleY * (124 - ToolBarHeight), ScaleX * 260, StdH)
    ResizeGadget(Window_ResizeTest_txtCompany, ScaleX * 810, ToolBarHeight + ScaleY * (124 - ToolBarHeight), ScaleX * 250, StdH)
    ResizeGadget(Window_ResizeTest_lblEmlAddrt, ScaleX * 500, ToolBarHeight + ScaleY * (184 - ToolBarHeight), ScaleX * 120, StdH)
    ResizeGadget(Window_ResizeTest_lblEmlAddrAlias, ScaleX * 720, ToolBarHeight + ScaleY * (184 - ToolBarHeight), ScaleX * 130, StdH)
    ResizeGadget(Window_ResizeTest_TxtAddremoveEmail, ScaleX * 500, ToolBarHeight + ScaleY * (204 - ToolBarHeight), ScaleX * 210, StdH)
    ResizeGadget(Window_ResizeTest_TxtAddEmlAlias, ScaleX * 720, ToolBarHeight + ScaleY * (204 - ToolBarHeight), ScaleX * 130, StdH)
    
    
    ResizeGadget(Window_ResizeTest_AddrUpdateEmail, ScaleX * 855, ToolBarHeight + ScaleY * (204 - ToolBarHeight),  60, 24)
    ResizeGadget(Window_ResizeTest_AddEmail, ScaleX * 927, ToolBarHeight + ScaleY * (204 - ToolBarHeight),  60,  24)
    ResizeGadget(Window_ResizeTest_RemoveEmail, ScaleX * 997, ToolBarHeight + ScaleY * (204 - ToolBarHeight),  60,  24)
    ResizeGadget(Window_ResizeTest_ListEmailsPerson, ScaleX * 500, ToolBarHeight + ScaleY * (234 - ToolBarHeight), ScaleX * 560, ScaleY * 200)
    ResizeGadget(Window_ResizeTest_Phoneslbl, ScaleX * 500, ToolBarHeight + ScaleY * (460 - ToolBarHeight), ScaleX * 580, StdH)
    ResizeGadget(Window_ResizeTest_ComboCommTypes, ScaleX * 500, ToolBarHeight + ScaleY * (484 - ToolBarHeight), ScaleX * 100, StdH)
    
    ResizeGadget(Window_ResizeTest_TxtAddremovePhone, ScaleX * 675, ToolBarHeight + ScaleY * (484 - ToolBarHeight), ScaleX * 175, StdH)
    ResizeGadget(Window_ResizeTest_AddrUpdatePhone, ScaleX * 855, ToolBarHeight + ScaleY * (484 - ToolBarHeight),  60,  24)
    ResizeGadget(Window_ResizeTest_AddCommunication, ScaleX * 927, ToolBarHeight + ScaleY * (484 - ToolBarHeight), 60,  24)
    ResizeGadget(Window_ResizeTest_RemoveCommunication, ScaleX * 997, ToolBarHeight + ScaleY * (484 - ToolBarHeight),  60, 24)
    
    
    Protected phoneh =  (ScaleY * 204)
    Protected phoney = ToolBarHeight + ScaleY * (514 - ToolBarHeight)
    Protected listend = GadgetY(Window_ResizeTest_ListAddresses) + GadgetHeight(Window_ResizeTest_ListAddresses)
    phoneh = listend - phoney
    ResizeGadget(Window_ResizeTest_ListPhonesPerson, ScaleX * 500, phoney, ScaleX * 560,phoneh) ;
    ResizeLists()
    
EndProcedure



Window_ResizeTest = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 1080, 762, "Address Book", #PB_Window_Invisible | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget |#PB_Window_SystemMenu |  #PB_Window_TitleBar ) ; | #PB_Window_ScreenCentered ; #PB_Window_WindowCentered, WindowID(Window_0)
WindowBounds(Window_ResizeTest, 1080, 762, 1512, 991) 
  
Menu_Window_ResizeTest()
ToolBar_Window_ResizeTest()
StatusBar_Window_ResizeTest()

        Window_ResizeTest_lblfind = TextGadget(#PB_Any, 10, 54, 60, 20, "Search")
        Window_ResizeTest_TxtSearch = StringGadget(#PB_Any, 80, 54, 370, 20, "")
        Window_ResizeTest_Imgbtn_ClearSearch =  ButtonGadget(#PB_Any, 460, 54, 22, 22,"X")
        GadgetToolTip(Window_ResizeTest_Imgbtn_ClearSearch, "Clear Search")
        Window_ResizeTest_Text_1 = TextGadget(#PB_Any, 500, 54, 100, 17, "First Name:")
        Window_ResizeTest_lblAdresAs = TextGadget(#PB_Any, 800, 54, 100, 17, "Address As:")
        Window_ResizeTest_FirstName = StringGadget(#PB_Any, 510, 74, 260, 20, "")
        Window_ResizeTest_txtAdresAs = StringGadget(#PB_Any, 810, 74, 260, 20, "")
        Window_ResizeTest_ListAddresses = ListIconGadget(#PB_Any, 10, 84, 470, 655, "", 32, #PB_ListIcon_FullRowSelect | #PB_ListIcon_MultiSelect | #PB_ListIcon_HeaderDragDrop | #PB_ListIcon_AlwaysShowSelection)
        Window_ResizeTest_Text_1_1 = TextGadget(#PB_Any, 500, 104, 130, 17, "Middle / Last Name:")
        Window_ResizeTest_LblCompany = TextGadget(#PB_Any, 800, 104, 100, 17, "Company:")
        Window_ResizeTest_LastName = StringGadget(#PB_Any, 510, 124, 260, 20, "")
        Window_ResizeTest_txtCompany = StringGadget(#PB_Any, 810, 124, 260, 20, "")
        Window_ResizeTest_lblEmlAddrt = TextGadget(#PB_Any, 500, 184, 120, 17, "Email Address:")
        Window_ResizeTest_lblEmlAddrAlias = TextGadget(#PB_Any, 720, 184, 100, 17, "Alias (optional):")
        Window_ResizeTest_TxtAddremoveEmail = StringGadget(#PB_Any, 500, 204, 210, 24, "")
            GadgetToolTip(Window_ResizeTest_TxtAddremoveEmail, "type contact's email address here")
        Window_ResizeTest_TxtAddEmlAlias = StringGadget(#PB_Any, 720, 204, 130, 24, "")
            GadgetToolTip(Window_ResizeTest_TxtAddEmlAlias, "type short name to include when replying")
        Window_ResizeTest_AddrUpdateEmail = ButtonGadget( #PB_Any, 850, 204, 60, 24, "Update")
        Window_ResizeTest_AddEmail = ButtonGadget( #PB_Any, 930, 204, 60, 24, "Add")
        Window_ResizeTest_RemoveEmail = ButtonGadget(#PB_Any, 1000, 204, 60, 24, "Remove")
        Window_ResizeTest_ListEmailsPerson = ListIconGadget(#PB_Any, 500, 234, 570, 200, "", 32,  #PB_ListIcon_FullRowSelect | #PB_ListIcon_HeaderDragDrop | #PB_ListIcon_AlwaysShowSelection)
        Window_ResizeTest_Phoneslbl = TextGadget(#PB_Any, 500, 464, 580, 17, "Phones, WEB, Messengers:")
        Window_ResizeTest_ComboCommTypes = ComboBoxGadget(#PB_Any, 500, 484, 110, 23)
        GadgetToolTip(Window_ResizeTest_ComboCommTypes, "Select Communication Type")
        Window_ResizeTest_TxtAddremovePhone = StringGadget(#PB_Any, 630, 484, 220, 24, "")
        
        Window_ResizeTest_AddrUpdatePhone = ButtonGadget( #PB_Any, 870, 484, 60, 24, "Update")
        Window_ResizeTest_AddCommunication = ButtonGadget( #PB_Any, 940, 484, 60, 24, "Add")
        Window_ResizeTest_RemoveCommunication = ButtonGadget( #PB_Any, 1010, 484, 60, 24, "Remove")
        Window_ResizeTest_ListPhonesPerson = ListIconGadget(#PB_Any, 500, 514, 570, 200, "", 0, #PB_ListIcon_FullRowSelect | #PB_ListIcon_HeaderDragDrop | #PB_ListIcon_AlwaysShowSelection)

SetGadgetText(Window_ResizeTest_TxtSearch,"Enter Search text...")
GadgetToolTip(Window_ResizeTest_TxtSearch,"Enter Search text. Press ENTER to search. Press CTRL + DEL to clear search")

AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Phone")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Mobile Phone")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Work Phone")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Work Mobile Phone")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "WEB Site")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Telegram")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Signal")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Facebook Messenger")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Viber")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Skype")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Facetime")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Whatsapp")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "IRC")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Other Messengers")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "IP Phone")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Fax")
AddGadgetItem(Window_ResizeTest_ComboCommTypes, -1, "Other")
SetGadgetText(Window_ResizeTest_ComboCommTypes, "Phone")

AddGadgetColumn(Window_ResizeTest_ListPhonesPerson, 1, "Type",130)
AddGadgetColumn(Window_ResizeTest_ListPhonesPerson, 2, "Data",130)
AddGadgetColumn(Window_ResizeTest_ListPhonesPerson, 3, "Primary",60)

  AddGadgetColumn(Window_ResizeTest_ListAddresses, 1, "First Name", 80)
  AddGadgetColumn(Window_ResizeTest_ListAddresses, 2, "Last Name", 80)
  AddGadgetColumn(Window_ResizeTest_ListAddresses, 3, "Email", 160)
  AddGadgetColumn(Window_ResizeTest_ListAddresses, 4, "Company", 150)
  AddGadgetColumn(Window_ResizeTest_ListAddresses, 5, "Address As", 160)
  
  
  
  AddGadgetColumn(Window_ResizeTest_ListEmailsPerson, 1, "Alias", 100)
  AddGadgetColumn(Window_ResizeTest_ListEmailsPerson, 2, "Email", 220)
  AddGadgetColumn(Window_ResizeTest_ListEmailsPerson, 3, "Primary", 60)
  AddGadgetColumn(Window_ResizeTest_ListEmailsPerson, 4, "Preferred Account", 120)
 
   
BindEvent(#PB_Event_SizeWindow,@Resize_Window_ResizeTest(),Window_ResizeTest)
PostEvent(#PB_Event_SizeWindow, Window_ResizeTest, 0)


HideWindow(Window_ResizeTest, 0)
Repeat
  Event = WaitWindowEvent()
  If Event
    Select Event
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  Else
    Delay(5)
  EndIf
ForEver
S.T.V.B.E.E.V.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by mk-soft »

Update:
Hostname Control;
* RunProgram: hostnamectl
- Static hostname: vm-linux-20
- Icon name: computer-vm
- Chassis: vm
- Machine ID: ***
- Boot ID: ***
- Virtualization: kvm
- Operating System: Ubuntu 20.04.6 LTS
- Kernel: Linux 5.15.0-91-generic
- Architecture: x86-64
Here works with my program 'Modul_ToolBarStandard.pb'
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
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

Ok, then I must be doing something wrong - my Ubuntu is the same version, dark mode (default one)

I'm confused - the same code above works fine in Windows and Mac (yes it is messy), do I miss some basic, like "Do not consider ToolbarHeight() on Linux" ?
S.T.V.B.E.E.V.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by mk-soft »

Only for windows must be added toolbar height ...
Not at macOS or Linux.

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  y = ToolBarHeight(0)
CompilerElse
  y = 0
CompilerEndIf
On macOS is ToolBarHeight(x) alway zero
Last edited by mk-soft on Mon Jan 08, 2024 2:34 pm, edited 2 times in total.
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
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

ok, documentation states only that
"On OS X this command returns 0, as the toolbar is not part of the window inner height so no calculation is needed. "
that implies that adding ToolbarHeight() would be fine on Linux and on MAc it would have no effect as it is 0.

Thank you, I will add another CompilerSelect (I counted 267 "Compilerselect" already in my code :-)

Thank you mksoft - your help is always appreciated!
S.T.V.B.E.E.V.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by mk-soft »

P.S.
PB uses OS API's to get the heights.
It's a bit silly that the API's of the different OS's work differently and you have to adapt them yourself.

Windows: Inner height including ToolBar and StatusBar. Y-position the ToolBar height must be considered.
Linux: Inner height including ToolBar and StatusBar. Y-position zero starts behind ToolBar .
MacOS: Inner height without ToolBar and with StatusBar. Y-position zero starts behind ToolBar.
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
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

Thank you.

What about the Menu : is it considered in Linux? Even if it is detached from the Window?
S.T.V.B.E.E.V.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by mk-soft »

Menu height must be subtracted. Y Zero Starts under Menu
MenuHeight is zero under macOS
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
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: ToolbarHeight() / WindowHeight() seem not to work correctly anymore

Post by pamen »

Lesson learned:
when using 3rd party designers or even PB designer - don't.
Think for yourself, ask for updated documentation :-)
I got this on all 4 systems, it is pain indeed.
Thanks again for the explanations mk-soft.
S.T.V.B.E.E.V.
Post Reply