ToolbarToolbar control Summary | | | | | | | Set all butons at once using textual definition | | | | Get count of buttons on the toolbar | | Delete button from the toolbar | | | | Get number of toolbar rows | | | | |
Add| Toolbar_Add( | hGui, | | | | hIL | = | "1S 7,8,9,|,2,3,|,4,5,10", | | style | = | "WRAPABLE FLAT LIST" | ) |
|
Add toolbar to the GUI Parameters| hGui | HWND of the GUI | | hIL | If number, handle of the image list that contains button images. If string (default), default image list will be used, see details bellow | | style | Styles to apply to the toolbar control, see list of styles bellow. |
Default image listIf hIL isn’t number, you must specify string in strict format. The syntax is *CS iconlist” where C is catalog number (1-4) and S is the icon size - S (small, 16px) or L (large, 24px). Iconlist is the list of icons you want to use from desired catalog (each catalog has different number of images - from 5 to 15) By default, hIL is set as ”1S 7,8,9,|,2,3,|,4,5,10” so that first catalog and large images are used, and icons as specified. You can set “|” instead of icon number to insert separator button at particular position Control Styles| WRAPABLE | Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can “wrap” to the next line when the toolbar becomes too narrow to include all buttons on the same line. When the toolbar is wrapped, the break will occur on either the rightmost separator or the rightmost button if there are no separators on the bar. This style must be set to display a vertical toolbar control when the toolbar is part of a vertical rebar control. This style cannot be combined with CCS_VERT. | | FLAT | Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are transparent and hot-tracking is enabled. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible. | | LIST | Creates a flat toolbar with button text to the right of the bitmap. Otherwise, this style is identical to TBSTYLE_FLAT. To prevent repainting problems, this style should be set before the toolbar control becomes visible. |
ReturnsHandle of the toolbar
SetButtonInfo| Toolbar_SetButtonInfo( | hToolbar, | | | | id, | | | | text | = | "", | | state | = | "" | ) |
|
Set button information Parameters| hToolbar | HWND of the toolbar | | id | Button identification (currently equal to buttons position) | | text | Text to set for the button. If “” text will not be changed. If “-” text wil be removed (the same as omiting both text and state parameters) | | state | List of button states to set, separated by white space. See bellow. |
Button statesCHECKED, ENABLED, HIDDEN, GRAYED, PRESSED, CLICKED ReturnsNonzero if successful, or zero otherwise.
SetButtons| Toolbar_SetButtons( | hToolbar, | | | | info | = | "" | ) |
|
Set all butons at once using textual definition Parameters| hToolbar | HWND of the toolbar | | info | Textual definition of buttons info. For each button there should be line containg text|state list where both text and state list are optional. You can also use “-” to skip button (the same as empty line). If you omit this parameter text and state for each button will be cleared |
GetButtonInfo| Toolbar_GetButtonInfo( | hToolbar, | | | | id, | | | | info | = | "text" | ) |
|
Get button information Parameters| hToolbar | HWND of the toolbar | | id | ID of the button (currently the same as position) | | info | What kind of info to return - text (default) or state |
GetButtonCount| Toolbar_GetButtonCount( | hToolbar | ) |
|
Get count of buttons on the toolbar Parameters| hToolbar | HWND of the toolbar |
ReturnsCount
DeleteButton| Toolbar_DeleteButton( | hToolbar, | | | | idx | = | 1 | ) |
|
Delete button from the toolbar Parameters| hToolbar | HWND of the toolbar | | idx | 1-based position of the button |
ReturnsTRUE if successful, or FALSE otherwise.
GetRect| Toolbar_GetRect( | hToolbar, | | id | ) |
|
Get button rectangle Parameters| hToolbar | HWND of the toolbar | | id | Button id |
ReturnsString with 4 rect values, separated by space
GetRows| Toolbar_GetRows( | hToolbar | ) |
|
Get number of toolbar rows Parameters| hToolbar | HWND of the toolbar |
ReturnsCount
ExampleGui, +LastFound hwnd := WinExist() Gui, Show ,w280 h200 ;set gui width & height (mandatory) hToolbar := Toolbar_Add(hwnd)
|