Setting toolbar height

I have done some searches, and I don’t see a real defined answer on this…

Me.Height = 50

Doesn’t seem to do anything on the open event of the toolbar. So is there some way to set the height? With my icons in it, there is a lot of extra space below them that is driving me nuts lol.

That extra space (if I recall) is for a caption,
It used to work that if you set the caption to CHRB(8) (backspace), then this space vanished. I stopped using the native toolbar along time ago, so things may have changed

A least on Mac, if there is no caption, the toolBar used to become shorter. Have not tested recently, though.

What do you guys use for a toolbar? Trying to make sure it isn’t OS specific.

I have been using the Xojo toolbar in Mac and Windows, with no issues. I appreciate the cross-platform aspect.

I usually just use the Xojo toolbar, but in one of my apps I wanted to try something (needed checkboxes and search field in there) and I simply used a 1 pixel wide and 50 pixel high image (a green gradient) and draw that in the window paint event stretched across the top. Seems to work fine. Advantage is that I can put any control into the “toolbar”.

If you need a macOS native toolbar, you have two choices:

  • MBS plugins
  • Retinakit 3 (Sam Rowland)

This can set any height depending on the controls you use in the toolbar.

[code] Declare Function toolbar Lib “Cocoa” Selector “toolbar” (NSWindow As Ptr) As Ptr

Dim toolbarPtr As Ptr = toolbar(Ptr(Self.Handle))

Declare Sub setShowsBaselineSeparator Lib “Cocoa” Selector “setShowsBaselineSeparator:” _
(NSToolbar As Ptr, flag As Boolean)
setShowsBaselineSeparator(toolbarPtr, false)

Declare Sub setDisplayMode Lib “Cocoa” Selector “setDisplayMode:” _
(NSToolbar As Ptr, NSToolbarDisplayMode As UInteger)
Const ToolbarDisplayModeDefault = 0
Const ToolbarDisplayModeIconAndLabel = 1
Const ToolbarDisplayModeIconOnly = 2
Const ToolbarDisplayModeLabelOnly = 3
setDisplayMode(toolbarPtr, ToolbarDisplayModeIconOnly)

Declare Sub setSizeMode Lib “Cocoa” Selector “setSizeMode:” _
(NSToolbar As Ptr, NSToolbarSizeMode As UInteger)
Const NSToolbarSizeModeDefault = 0
Const NSToolbarSizeModeRegular = 1
Const NSToolbarSizeModeSmall = 2
setSizeMode(toolbarPtr, NSToolbarSizeModeSmall)[/code]