Toolbar properties

Toolbars have two sets of properties - dynamic and static.

 

Dynamic properties can be changed while the toolbar is running. Position - move the toolbar (right-drag). Size - resize the toolbar (drag an edge). Some other properties can be changed in the right-click menu. Dynamic properties are automatically saved in current main QM file.

 

Static properties can be changed in the Properties dialog. They are saved in toolbar text, first line, and also can be edited directly there. They are described below. If toolbar position, size or right-click menu settings are specified, the specified static properties are used instead of the automatically saved dynamic properties.

 

Syntax

 /option1 [parameters] [/option2 [parameters] ...]

 

Space or semicolon, and one or more options. Each option begins with / and can have 1-2 parameters. If some parameter is not used, it can be omitted or "". Numeric parameters can be simple integer values, named constants, global variables, functions, {code} and expressions with operators. Expression with spaces or / must be enclosed in parentheses.

 

Example (first line of toolbar text):

 

 /col 0x80C0FF /hcol "" 0xFF /style WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX 0

 

A numeric parameter can be or contain code enclosed in { }. The code is executed as function, when creating the toolbar, in main QM thread. The code should return a value (ret). In code and user-defined functions, toolbar owner window handle is val(_command).

 

Examples:

 /mov 200 {ret GetClientTop(val(_command))-20}
 /mov 200 TB_ClientY-20

 

Use mov0, siz0, ssiz0 and set0 to apply these options only first time and after Reset.

Available options

1. Set toolbar position.

 /mov x y

 

Here x and y are toolbar position, in pixels. If the parameters are (or begin with) xm and ym, toolbar will be under the mouse pointer. Coordinates are relative to the owner window or screen top-left or other corner (depends on the Coordinates setting; see also /client). Use mov0 to apply only first time.

 

Examples:

 /mov 200 0
 /mov xm ym+100
 /mov 200 -23 /client

 

2. Set toolbar dimensions.

 /siz width height

 

Use siz0 to apply only first time.

 

3. Set toolbar dimensions for shrinked state.

 /ssiz width height

 

Use ssiz0 to apply only first time.

 

4. Set icon size.

 /isiz width height

 

Default size is 16x16. If cy is omitted, it will be equal to cx. If cx is more than cy, text is placed below icon.

 

5. Set maximum and/or minimum button size.

 /bsiz maxwidth minwidth

 

QM 2.2.1: Works with all styles. Added minwidth.

 

6. Set initial settings of the right-click menu. In the Properties dialog it is "Style flags".

 /set flags mask

 

flags:

1 Follow owner window when it is moved or resized.
2 Show button text.
4 Activate owner window on click.
8 Auto shrink.
16 Equal-width buttons.
32 No sizing border.
64 Show tooltips always, even if button text is shown.
128 Use as vertical toolbar. Line breaks will be horizontal.
0x000 Coordinates: top-left.
0x100 Coordinates: top-right.
0x200 Coordinates: bottom-left.
0x300 Coordinates: bottom-right.
0x400 Coordinates: auto select.
0x1000 Show in all virtual desktops.
0x2000 Quick icons. Uses an icon cache.
0x4000 (QM 2.2.0) 1-pixel border.
0x8000 (QM 2.2.1) 3D buttons.
0x10000 (QM 2.3.1) When a file dropped, open it with the button program. Don't show a menu.
0x20000 (QM 2.3.3) Hide if a full-screen window is active.
0x40000 (QM 2.3.3) Super on-top. Make on top of other alway-on-top windows, eg taskbar.

mask - use to change only some flags. Will be changed only those bits of flags that are 1 in mask. First time are applied all flags regardless of mask.

 

Example:

 /set 1|2|8|0x400

 

Use set0 to apply only first time.

 

7. Set toolbar window style and extended style.

 /style st exst

 

Here st and exst are style and extended style of the toolbar window. Can be used style constant names, like in the example. Reference - MSDN.

 

Example:

 /style (WS_CAPTION | WS_SYSMENU)

 

8. Set background and text color.

 /col color textcolor

 

Here color and textcolor are colors in 0xBBGGRR format. Value 1 to 31 will set one of system colors.

 

9. Set hot item background and text color.

 /hcol color textcolor

 

If you set hot item background color, Windows themes (visual styles) are not applied, and the toolbar may look differently.

 

Does not work when 3D buttons.

 

10. Set transparency.

 /transp opacity color

 

opacity - value between 0 (makes the toolbar completely transparent) and 255 (completely opaque).

color - sets the specified color completely transparent. Completely transparent areas are transparent to the mouse too. Optional.

 

On Vista and later, hot button may look distorted. It is because its color is gradient, and some lines match the transparent color and therefore are transparent. Try to change background color with /col.

 

11. Set background image. Can be bmp, gif, jpg. QM 2.3.4: also can be png.

 /bmp "file"

 

Example:

 /bmp "$my qm$\images	b1.bmp"

 

12. Glass. QM 2.2.0.

 /glass

 

On Windows Vista and 7, if Windows Aero theme is enabled, the toolbar will be translucent, like title bars of windows. Incompatible with /bmp, transparent color and hot color (these are ignored if /glass is used).

 

13. Set font. QM 2.2.0.

 /font XXXX

 

Font can be set in Properties.

 

On Vista and later, does not work when 3D buttons.

 

14. Lock toolbar.

 /lock flags

 

flags:

1 don't show the right-click menu.
2 disable moving.
4 disable resizing.
8 disable modifying. This disables drag&drop features, and three first items in the right-click menu. Even if this option is not used, a toolbar cannot be modified if it is encrypted or in a read-only folder or file.
16 disable the Close item in the right-click menu.
128 lock only if the toolbar is in a shared file ([s] folder).

 

If flags is not used, are applied all flags except 128.

 

15. Toolbar position specified in mov/mov0 is relative to the client area of the owner window, or to the work area if no owner. QM 2.4.3.

 /client

 

16. Set hook function.