Rebar control act as container for child windows. An application assigns child windows, which are often other controls, to a rebar control band. Rebar controls contain one or more bands, and each band can have any combination of a gripper bar, a bitmap, a text label, and a child window. However, bands cannot contain more than one child window. As you dynamically reposition a rebar control band, the rebar control manages the size and position of the child window assigned to that band.
(See rebar.png)
Rebar | Rebar control act as container for child windows. |
Add | Add a rebar to the GUI. |
Count | Retrieves the number of bands in a rebar control. |
DeleteBand | Deletes a band from a rebar control. |
GetBand | Get band information. |
GetLayout | Get layout of bands in rebar. |
GetRect | Get band rectangle. |
Height | Returns the height of the rebar control. |
Id2Index | Returns 1 based position of the band with given id. |
Insert | Inserts a new band in a rebar control. |
Lock | Locks or unlcoks the rebar (sets or removes “nogripper” style for all bands in rebar) |
MoveBand | Moves a band from one index to another. |
SetBand | Sets characteristics of an existing band in a rebar control. |
SetBandState | Minimize or maximize the band. |
SetBandWidth | Sets the width for a band. |
SetBandStyle | Sets the style for a band. |
SetLayout | Set layout of bands in rebar. |
SizeToRect | |
ShowBand | Shows or hides the band. |
Examples | |
About |
Rebar_Add( hGui, Style = "", hIL = "", Pos = "", Handler = "" )
Add a rebar to the GUI.
hGui | Handle of the GUI. |
Style | White space separated list of styles. See bellow for details. By default “VARHEIGHT DBLCLKTOGGLE”. Integer styles are allowed. |
hIL | Handle of the image list associated with the control. Optional. |
Pos | Position of the rebar in usual AHK style. Optional. |
Handler | Notification handler. |
autosize | The rebar control will automatically change the layout of the bands when the size or position of the control changes. |
bandborders | The rebar control displays narrow lines to separate adjacent bands. |
dblclktoggle | The rebar band will toggle its maximized or minimized state when the user double-clicks the band. Without this style, the maximized or minimized state is toggled when the user single-clicks on the band. |
fixedorder | The rebar control always displays bands in the same order. You can move bands to different rows, but the band order is static. |
varheight | The rebar control displays bands at the minimum required height, when possible. Without this style, the rebar control displays all bands at the same height, using the height of the tallest visible band to determine the height of other bands. |
verticalgripper | The size grip will be displayed vertically instead of horizontally in a vertical rebar control. |
vertical | Causes the control to be displayed vertically. |
Handler(hCtrl, Event)
Event | C (Chevron click) L (Layout change) H (Height change). |
Handle to the newly created control or 0 if function failes. Error message is returned on invalid usage.
Rebar_GetBand( hRebar, WhichBand, pQ = "", ByRef o1 = "", ByRef o2 = "", ByRef o3 = "", ByRef o4 = "", ByRef o5 = "", ByRef o6 = "", ByRef o7 = "" )
Get band information.
WhichBand | Band position or ID. |
pQ | Query parameter: S (Style), L (Length), C (Color), I (Icon index), T (Text), N (identificatioN), B (Bitmap handle). |
o1..o7 | Reference to output variables. |
o1
Rebar_GetLayout( hRebar )
Get layout of bands in rebar. Layout is single line string containing information about position of bars in the rebar control. Return value of this function is fed into SetLayout later, to restore layout.
Rebar_GetRect( hRebar, WhichBand = "", pQ = "", ByRef o1 = "", ByRef o2 = "", ByRef o3 = "", ByRef o4 = "" )
Get band rectangle.
WhichBand | Band position or ID. Leave blank to get dimensions of the rebar control itself. |
pQ | Query parameter: set x,y,w,h to return appropriate value, or leave blank to return all in single line. |
o1 .. o4 | Output variables. |
String with 4 values separated by space or requested information.
Rebar_Insert( hRebar, hCtrl, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "" )
Inserts a new band in a rebar control.
hCtrl | Control to be hosted by the band. |
o1 .. o8 | Named parameters. See below. |
S | Band styles separated by white space. By default “gripperalways”. See bellow. |
L | Length of the band. By default, width of the child control is used + 10px |
mW | Minimum width of the child control. |
mH | Minimum height of the child control. By default the height of the child control. |
I | Header icon index. |
T | Header text. |
C | Background and foreground color separated by space. |
BG | Background bitmap. |
P | 1-based position of the band. Set to 0 add the band to the end (default). |
break | The band is on a new line. |
childedge | The band has an edge at the top and bottom of the child window. |
fixedbmp | The background bitmap does not move when the band is resized. |
fixedsize | The band can’t be sized. With this style, the sizing grip is not displayed on the band. |
gripperalways | The band will always have a sizing grip, even if it is the only band in the rebar. |
hidden | The band will not be visible. Don’t use this flag in Insert function. Instead, insert the band without this flag, then use SetBand to hide it. To restore it afterwards, use SetBand with “S show” parameter. |
nogripper | The band will never have a sizing grip, even if there is more than one band in the rebar. |
usechevron | Show a chevron button if the band is smaller than ideal. |
novert | Don’t show when vertical. |
hidetitle | Keep band title hidden. |
* | Default styles for the band. For instance “* break” will set band style to default plus “break” style. |
ID of the newly created band or 0 if it fails.
For some reason, using the Gui, Font to change font size before adding ComboBox child to the band will make it buggy in a sense that ComboBox list will not be able to show (although you can still select items using arrows).
Rebar_SetBand( hRebar, WhichBand, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "" )
Sets characteristics of an existing band in a rebar control.
WhichBand | Band position or ID that is about to be changed. |
o1 .. o9 | Named parameters. Any named parameter that can be specified in Add function can be used here. |
TRUE if successful, FALSE otherwise.
Rebar_SetBandState( hRebar, WhichBand, State )
Minimize or maximize the band.
WhichBand | Band position or ID. Leave blank to get dimensions of the rebar control itself. |
State | Set “-” to minimize, “+” to maximize to full width, “*” to maximize to ideal width (this is the width of the control when it is added to the band). |
Rebar_SetBandStyle( hRebar, WhichBand, Style )
Sets the style for a band.
WhichBand | Band position or ID. |
Style | List of styles to add/remove for the band. Use - prefix to remove the style. |
TRUE if successful, or FALSE otherwise.
If you want to to replace band styles completely use SetBand function with S parameter. This function toggles desired styles.
Rebar_SetLayout( hRebar, Layout )
Set layout of bands in rebar.
Layout | String with information about position of bands in rebar control. Use GetLayout function to get this string. Layout syntax is: |
id1 len1 break1|id2 len2 break2|....|idN lenN breakN
Rebar_SizeToRect( hRebar, ByRef RECT = "~`a " )
RECT | Reference to rectangle structure. If omited, parents rectangle will be used (GetClientRect). |
The rebar bands will be arranged and wrapped as necessary to fit the rectangle. Bands that have the VARIABLEHEIGHT style will be resized as evenly as possible to fit the rectangle. The height of a horizontal rebar or the width of a vertical rebar may change, depending on the new layout.
Rebar_ShowBand( hRebar, WhichBand, bShow = true )
Shows or hides the band.
WhichBand | Band position or ID. Leave blank to get dimensions of the rebar control itself. |
bShow | True to show the band (default), FALSE to hide it. |
TRUE if successful, or FALSE otherwise.
This function can also be used to resize the band to mach the parents size. Put call to this function inside GuiSize routine. Update to first band will reposition all bands to match the Gui size. return
Gui, +LastFound +Resize hGui := WinExist() Gui, Show, w400 h140 hide ;set window size, mandatory ;create edit Gui, Add, Edit, HWNDhEdit w100 h100 ;create combo Gui, Add, ComboBox, HWNDhCombo w80, item 1 |item 2|item 3 ;create rebar hRebar := Rebar_Add(hGui) ReBar_Insert(hRebar, hEdit, "mw 100", "L 400", "T Log ") ;Insert edit band, set lenght of the band to 400 ; minimum width of edit to 100, set text to "Log " ReBar_Insert(hRebar, hCombo, "L 300", "P 1") ;Insert combo band at the top, set length of the band to 300 Gui, Show return
Add a rebar to the GUI.
Rebar_Add( hGui, Style = "", hIL = "", Pos = "", Handler = "" )
Retrieves the number of bands in a rebar control.
Rebar_Count( hRebar )
Deletes a band from a rebar control.
Rebar_DeleteBand( hRebar, WhichBand )
Get band information.
Rebar_GetBand( hRebar, WhichBand, pQ = "", ByRef o1 = "", ByRef o2 = "", ByRef o3 = "", ByRef o4 = "", ByRef o5 = "", ByRef o6 = "", ByRef o7 = "" )
Get layout of bands in rebar.
Rebar_GetLayout( hRebar )
Get band rectangle.
Rebar_GetRect( hRebar, WhichBand = "", pQ = "", ByRef o1 = "", ByRef o2 = "", ByRef o3 = "", ByRef o4 = "" )
Returns the height of the rebar control.
Rebar_Height( hRebar )
Inserts a new band in a rebar control.
Rebar_Insert( hRebar, hCtrl, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "" )
Locks or unlcoks the rebar (sets or removes “nogripper” style for all bands in rebar)
Rebar_Lock( hRebar, Lock = "" )
Moves a band from one index to another.
Rebar_MoveBand( hRebar, From, To = 1 )
Sets characteristics of an existing band in a rebar control.
Rebar_SetBand( hRebar, WhichBand, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "" )
Minimize or maximize the band.
Rebar_SetBandState( hRebar, WhichBand, State )
Sets the width for a band.
Rebar_SetBandWidth( hRebar, WhichBand, Width )
Sets the style for a band.
Rebar_SetBandStyle( hRebar, WhichBand, Style )
Set layout of bands in rebar.
Rebar_SetLayout( hRebar, Layout )
Rebar_SizeToRect( hRebar, ByRef RECT = "~`a " )
Shows or hides the band.
Rebar_ShowBand( hRebar, WhichBand, bShow = true )