CreateToolBar ( icons$,x,y,width,height,group[,style] )

Parameters

icons$ - path to a horizontal BMP icon strip; an empty string selects the standard Windows toolbar images

x,y - position of the toolbar's top-left corner within the group's client area

width,height - size of the toolbar

group - window or gadget group that owns the toolbar

style (optional) - 0 (default); other values are reserved

Description

Creates a native toolbar gadget from an icon strip and returns its handle.

A toolbar is a row of native icon buttons. Its buttons can come from a horizontal icon strip - the same BMP strips BlitzPlus used - with one square icon per button. Pass an empty path to use the standard Windows New, Open, Save, Cut, Copy, and Paste images, which is what the world editor shell does. The runtime scales them when the window DPI changes. In the Light and Dark GUI themes (see SetGuiTheme) the standard images are drawn from Windows' own icon font in the theme's text colour; an icon strip's images are always used as they are.

Clicking a button posts a gadget-action event ($401) with the button's zero-based index in EventData and the toolbar in EventSource. Add hover tips with SetToolBarTips (one comma-separated string), and grey out unavailable commands with DisableToolBarItem / EnableToolBarItem by the same index.

Icon strips are copied into the toolbar, so a strip loaded with LoadIconStrip can be freed straight afterwards. Pin the toolbar across the top of the window with SetGadgetLayout toolbar,1,1,1,0.

See it working in the world editor shell sample.


See also: SetToolBarTips, EnableToolBarItem, DisableToolBarItem, LoadIconStrip, SetGadgetIconStrip, FreeIconStrip.

Index