Set Toolbar Size

Just starting out? Need help? Post your questions and find answers here.
andreasahlen
New User
New User
Posts: 7
Joined: Fri Jul 06, 2018 10:55 am
Location: Wasserburg am Inn (BY / DE)

Set Toolbar Size

Post by andreasahlen »

Hello,

I'm playing along with PureBasic for several days now to evaluate it. I created a Toolbar inside the UI designer. But I cannot find any property to set the Toolbar's height. On my current screen resolution all seems so small. Is there any way to set a default Toolbar.Height based on the current screen resolution (design time + runtime)?

Thanks a lot :)
-------
Regards | Saluti | Grüße
Andy
-------
Happy coding :)
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Set Toolbar Size

Post by RSBasic »

Is that what you mean?

Code: Select all

EnableExplicit

Define TBID

CreateImage(1, 32, 32, 24, 200)

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  If CreateToolBar(0, WindowID(0))
    TBID = SendMessage_(ToolBarID(0), #TB_GETIMAGELIST, 0, 0)
    ImageList_SetIconSize_(TBID, 32, 32)
    SendMessage_(ToolBarID(0), #TB_SETIMAGELIST, 0, TBID)
    SendMessage_(ToolBarID(0), #TB_AUTOSIZE, 0, 0)
    ToolBarImageButton(1, ImageID(1))
    ToolBarImageButton(2, ImageID(1))
    ToolBarImageButton(3, ImageID(1))
  EndIf
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
(only Windows)
Image
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4979
Joined: Sun Apr 12, 2009 6:27 am

Re: Set Toolbar Size

Post by RASHAD »

Welcome
PureBasic is full with amazing functions
You will not regret it

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateToolBar(0, WindowID(0),#PB_ToolBar_Large|#PB_ToolBar_Text)
      ToolBarStandardButton(0, #PB_ToolBarIcon_New,#PB_ToolBar_Normal,"New")
      ToolBarStandardButton(1, #PB_ToolBarIcon_Open,#PB_ToolBar_Normal,"Open")
      ToolBarStandardButton(2, #PB_ToolBarIcon_Save,#PB_ToolBar_Normal,"Save")
    EndIf
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Menu
        Debug "ToolBar ID: "+Str(EventMenu())
      EndIf
    Until Event = #PB_Event_CloseWindow 
  EndIf
Egypt my love
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Set Toolbar Size

Post by RSBasic »

Oops, I forgot PB could do that now. :D
Image
Image
andreasahlen
New User
New User
Posts: 7
Joined: Fri Jul 06, 2018 10:55 am
Location: Wasserburg am Inn (BY / DE)

Re: Set Toolbar Size

Post by andreasahlen »

Thank to both fo you. I will use these snippets as a starting point.
-------
Regards | Saluti | Grüße
Andy
-------
Happy coding :)
Post Reply