Repository navigation
SysWin Gui Rebar
Home › All Categories › sys/win › sys/win/gui › Rebar
Inserts, moves, sizes and queries the bands of a rebar, the container for toolbars.
A rebar (also called a coolbar) is a strip across the top of a window divided into bands.
Each band can hold one child window, usually a toolbar or a combo box, and may have a gripper,
a label and a background bitmap; the user drags bands to reorder and resize them, and bands wrap
onto further rows when the window is too narrow. Create one with
CWindow.AddControl( "Rebar", ... ) and pass WM_SIZE on to it from the parent's window
procedure so that it follows the window's width. Every function here takes the rebar's handle
first and is written with the namespace: Rebar.InsertBand( hRebar, ... ).
A band is described by a REBARBANDINFOW whose fMask says which members are meant
(RBBIM_CHILD, RBBIM_CHILDSIZE, RBBIM_SIZE, RBBIM_IDEALSIZE, RBBIM_STYLE, RBBIM_TEXT,
RBBIM_ID …). InsertBand, GetBandInfo and
SetBandInfo fill in cbSize for you: the version 6 size when the common
controls in use are version 6 (a manifest or EnableVisualStyles()), the older, shorter size
otherwise. Bands have a zero-based index, their place from the first band, which changes as
bands move, and an identifier (wID) you choose, which does not; IdToIndex
converts. When a band is given a child window, the rebar makes itself that window's parent and
sizes it; deleting the band hides the child but does not destroy it.
#import "sys/win"
#import "sys/win/gui"
using win, guiA rebar holding two bands: a toolbar with the standard Back and Forward images, and an edit box labelled "Find". The Swap button moves the first band after the second and puts the find band's new index and the rebar's height in the caption.
#import "sys/win"
#import "sys/win/gui"
using win, gui
const IDC_REBAR = 100
const IDC_TOOLBAR = 101
const IDC_FIND = 102
const ID_BAND_TOOLS = 1
const ID_BAND_FIND = 2
enum
IDM_BACK = 1001
IDM_FORWARD
IDM_SWAP
end enum
declare function WndProc( byval hwnd as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM ) as LRESULT
function main() as long
SetProcessDpiAwareness( PROCESS_SYSTEM_DPI_AWARE )
EnableVisualStyles()
dim pWindow as CWindow = "RebarDemo"
dim hWin as HWND = pWindow.Create( NULL, "Rebar", @WndProc )
pWindow.SetClientSize( 480, 200 )
pWindow.Center()
dim hRebar as HWND = pWindow.AddControl( "Rebar", hWin, IDC_REBAR )
' // A toolbar that the band sizes, not its parent
dim hToolBar as HWND = pWindow.AddControl( "Toolbar", hWin, IDC_TOOLBAR, "", 0, 0, 0, 0, _
WS_VISIBLE or TBSTYLE_FLAT or TBSTYLE_LIST or CCS_NORESIZE or CCS_NODIVIDER or CCS_NOPARENTALIGN )
ToolBar.LoadImages( hToolBar, IDB_HIST_SMALL_COLOR )
ToolBar.AddButton( hToolBar, HIST_BACK, IDM_BACK, 0, BTNS_AUTOSIZE, 0, "Back" )
ToolBar.AddButton( hToolBar, HIST_FORWARD, IDM_FORWARD, 0, BTNS_AUTOSIZE, 0, "Forward" )
ToolBar.AddButton( hToolBar, HIST_VIEWTREE, IDM_SWAP, 0, BTNS_AUTOSIZE, 0, "Swap" )
var (cx, cy) = ToolBar.GetMaxSize( hToolBar )
dim rbbi as REBARBANDINFOW
rbbi.fMask = RBBIM_STYLE or RBBIM_CHILD or RBBIM_CHILDSIZE or RBBIM_SIZE or RBBIM_IDEALSIZE or RBBIM_ID
rbbi.fStyle = RBBS_CHILDEDGE or RBBS_GRIPPERALWAYS
rbbi.hwndChild = hToolBar
rbbi.cxMinChild = cx : rbbi.cyMinChild = cy
rbbi.cx = cx + 20 : rbbi.cxIdeal = cx
rbbi.wID = ID_BAND_TOOLS
Rebar.InsertBand( hRebar, -1, rbbi )
' // A labelled band: the label needs the Unicode message
dim hFind as HWND = pWindow.AddControl( "Edit", hWin, IDC_FIND, "", 0, 0, 160, 22 )
dim wszLabel as wstring * 16 = "Find"
dim rbFind as REBARBANDINFOW
rbFind.cbSize = REBARBANDINFO_V6_SIZE
rbFind.fMask = RBBIM_STYLE or RBBIM_CHILD or RBBIM_CHILDSIZE or RBBIM_SIZE or RBBIM_TEXT or RBBIM_ID
rbFind.fStyle = RBBS_CHILDEDGE
rbFind.hwndChild = hFind
rbFind.cxMinChild = 100 : rbFind.cyMinChild = GetWindowHeight( hFind )
rbFind.cx = 220
rbFind.lpText = @wszLabel
rbFind.wID = ID_BAND_FIND
SendMessageW( hRebar, RB_INSERTBANDW, -1, cast( LPARAM, @rbFind ) )
return pWindow.DoEvents( SW_NORMAL )
end function
function WndProc( byval hwnd as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM ) as LRESULT
select case uMsg
case WM_SIZE
SendMessageW( GetDlgItem( hwnd, IDC_REBAR ), WM_SIZE, 0, 0 )
return 0
case WM_COMMAND
if CBCTL( wParam, lParam ) = IDM_SWAP then
dim hRebar as HWND = GetDlgItem( hwnd, IDC_REBAR )
Rebar.MoveBand( hRebar, 0, 1 )
SetWindowText( hwnd, "Find is band " & Rebar.IdToIndex( hRebar, ID_BAND_FIND ) & _
", rebar height " & Rebar.GetBarHeight( hRebar ) )
end if
return 0
case WM_DESTROY
PostQuitMessage( 0 )
return 0
end select
return DefWindowProcW( hwnd, uMsg, wParam, lParam )
end function
end main()| Function | Does |
|---|---|
| InsertBand | Inserts a band. |
| DeleteBand | Deletes a band. |
| GetBandCount | Returns the number of bands. |
| GetBandInfo | Reads a band's attributes into a REBARBANDINFOW. |
| SetBandInfo | Changes a band's attributes from a REBARBANDINFOW. |
| IdToIndex | Returns the index of the band with an identifier. |
| MoveBand | Moves a band to another index. |
| ShowBand | Shows or hides a band. |
| MaximizeBand | Widens a band to its ideal or largest width. |
| MinimizeBand | Narrows a band to its smallest width. |
| SetBandWidth | Sets the width of a band. |
| GetRect | Returns the rectangle of a band. |
| GetBandBorders | Returns the borders of a band. |
| GetBandMargins | Returns the margins around band children. |
| GetBarHeight | Returns the height of the rebar. |
| GetRowCount | Returns the number of rows of bands. |
| GetRowHeight | Returns the height of a row. |
| SizeToRect | Lays the bands out to fit a rectangle. |
| HitTest | Finds the band, and the part of it, at a point. |
| GetBarInfo | Reads the rebar's image list. |
| SetBarInfo | Sets the rebar's image list. |
| GetBkColor | Returns the default band background colour. |
| SetBkColor | Sets the default band background colour. |
| GetTextColor | Returns the default band text colour. |
| SetTextColor | Sets the default band text colour. |
| GetColorScheme | Reads the highlight and shadow colours. |
| SetColorScheme | Sets the highlight and shadow colours. |
| GetPalette | Returns the rebar's palette. |
| SetPalette | Sets the rebar's palette. |
| GetTooltips | Returns the rebar's tooltip control. |
| SetTooltips | Gives the rebar a tooltip control. |
| SetParent | Sets the window that receives the rebar's notifications. |
| SetWindowTheme | Gives the rebar a visual style by name. |
| SetDarkMode, RemoveDarkMode | Gives the rebar the dark theme, or its normal one. |
| BeginDrag, DragMove, EndDrag | Drag a band from code. |
| PushChevron | Pushes a band's chevron from code. |
| GetDropTarget | Returns the rebar's IDropTarget. |
function InsertBand overload( byval hRebar as HWND, byval nIndex as long, byval prbbi as REBARBANDINFOW ptr ) as boolean
function InsertBand overload( byval hRebar as HWND, byval nIndex as long, byref rbbi as REBARBANDINFOW ) as booleanInserts a band before the band at index nIndex; -1 adds it after the last. Fill in the members
the band needs and name them in fMask; cbSize is set for you. For a band holding a child,
hwndChild with RBBIM_CHILD, and its smallest size, cxMinChild and cyMinChild, with
RBBIM_CHILDSIZE. cx (RBBIM_SIZE) is the band's width. fStyle (RBBIM_STYLE) takes RBBS_*
styles such as RBBS_CHILDEDGE, RBBS_GRIPPERALWAYS, RBBS_NOGRIPPER, RBBS_BREAK (start a
new row), RBBS_FIXEDSIZE and RBBS_USECHEVRON.
Returns true on success.
Example
dim rbbi as REBARBANDINFOW
rbbi.fMask = RBBIM_CHILD or RBBIM_CHILDSIZE or RBBIM_SIZE or RBBIM_ID
rbbi.hwndChild = GetDlgItem( hwnd, 101 ) : rbbi.cxMinChild = 120 : rbbi.cyMinChild = 24
rbbi.cx = 200 : rbbi.wID = 3
Rebar.InsertBand( hCtrl, -1, rbbi )Microsoft Learn: RB_INSERTBAND
function DeleteBand( byval hRebar as HWND, byval uBand as DWORD ) as booleanDeletes the band at index uBand. Its child window is not destroyed: it stays a child of the
rebar, hidden, for you to reuse or destroy.
Returns true on success.
Example
Rebar.DeleteBand( hCtrl, Rebar.IdToIndex( hCtrl, 3 ) )Microsoft Learn: RB_DELETEBAND
function GetBandCount( byval hRebar as HWND ) as DWORDReturns the number of bands, hidden ones included.
Example
print Rebar.GetBandCount( hCtrl ); " bands"Microsoft Learn: RB_GETBANDCOUNT
function GetBandInfo overload( byval hRebar as HWND, byval uBand as DWORD, byval prbbi as REBARBANDINFOW ptr ) as boolean
function GetBandInfo overload( byval hRebar as HWND, byval uBand as DWORD, byref rbbi as REBARBANDINFOW ) as boolean
function GetBandInfo overload( byval hRebar as HWND, byval uBand as DWORD ) as REBARBANDINFOWReads the attributes that fMask asks for of the band at index uBand; cbSize is set for you.
For the text, point lpText at a buffer and set cch.
Returns true on success.
Example
dim rbbi as REBARBANDINFOW
rbbi.fMask = RBBIM_ID or RBBIM_SIZE or RBBIM_CHILD
if Rebar.GetBandInfo( hCtrl, 0, rbbi ) then print "band"; rbbi.wID; " is"; rbbi.cx; " wide"Microsoft Learn: RB_GETBANDINFO
function SetBandInfo overload( byval hRebar as HWND, byval uBand as DWORD, byval prbbi as REBARBANDINFOW ptr ) as boolean
function SetBandInfo overload( byval hRebar as HWND, byval uBand as DWORD, byref rbbi as REBARBANDINFOW ) as booleanChanges the attributes that fMask names of the band at index uBand; the others stay as they
are. cbSize is set for you.
Returns true on success.
Example
dim rbbi as REBARBANDINFOW
rbbi.fMask = RBBIM_STYLE : rbbi.fStyle = RBBS_CHILDEDGE or RBBS_BREAK ' start a new row
Rebar.SetBandInfo( hCtrl, 1, rbbi )
dim lbl as REBARBANDINFOW
lbl.cbSize = REBARBANDINFO_V6_SIZE : lbl.fMask = RBBIM_TEXT : lbl.lpText = @wstr( "Search" )
SendMessageW( hCtrl, RB_SETBANDINFOW, 1, cast( LPARAM, @lbl ) )Microsoft Learn: RB_SETBANDINFO
function IdToIndex( byval hRebar as HWND, byval uBandID as DWORD ) as longReturns the index of the band whose identifier (wID) is uBandID, the first one if several
share it, or -1 when there is none.
Example
dim i as long = Rebar.IdToIndex( hCtrl, 2 )
if i >= 0 then Rebar.ShowBand( hCtrl, i, false )Microsoft Learn: RB_IDTOINDEX
function MoveBand( byval hRebar as HWND, byval nFrom as DWORD, byval nTo as DWORD ) as booleanMoves the band at index nFrom to index nTo.
Returns true on success.
Example
Rebar.MoveBand( hCtrl, 0, Rebar.GetBandCount( hCtrl ) - 1 ) ' first to lastMicrosoft Learn: RB_MOVEBAND
function ShowBand( byval hRebar as HWND, byval uBand as DWORD, byval fShow as boolean ) as booleanShows (fShow true) or hides the band at index uBand. A hidden band keeps its index and still
counts in GetBandCount.
Returns true on success.
Example
Rebar.ShowBand( hCtrl, 1, false )Microsoft Learn: RB_SHOWBAND
sub MaximizeBand( byval hRebar as HWND, byval uBand as DWORD, byval fIdeal as boolean )Widens the band at index uBand: to its ideal width (cxIdeal) when fIdeal is true, or as
far as the row allows when it is false.
Example
Rebar.MaximizeBand( hCtrl, 0, true )Microsoft Learn: RB_MAXIMIZEBAND
sub MinimizeBand( byval hRebar as HWND, byval uBand as DWORD )Narrows the band at index uBand to its smallest width.
Example
Rebar.MinimizeBand( hCtrl, 0 )Microsoft Learn: RB_MINIMIZEBAND
function SetBandWidth( byval hRebar as HWND, byval uBand as DWORD, byval nWidth as DWORD ) as booleanSets the width of the band at index uBand to nWidth pixels. This function is only compiled
when the Windows headers target exactly Windows 8, which the toolchain's do not (they target
Windows 10), so a call to Rebar.SetBandWidth stops with "the namespace 'rebar' has no member
named 'setbandwidth'". Send the message instead, as in the example.
Returns true on success.
Example
SendMessageW( hCtrl, RB_SETBANDWIDTH, 0, 180 ) ' what Rebar.SetBandWidth( hCtrl, 0, 180 ) sendsMicrosoft Learn: RB_SETBANDWIDTH
function GetRect overload( byval hRebar as HWND, byval uBand as DWORD, byval prc as RECT ptr ) as boolean
function GetRect overload( byval hRebar as HWND, byval uBand as DWORD, byref rc as RECT ) as boolean
function GetRect overload( byval hRebar as HWND, byval uBand as DWORD ) as ( long, long, long, long )Reads the rectangle of the band at index uBand, in client coordinates of the rebar. The third
form returns ( left, top, right, bottom ) and leaves the message's result in GetLastError():
nonzero on success, 0 on failure.
Returns true on success (first two forms); the four edges (third form).
Example
var (l, t, r, b) = Rebar.GetRect( hCtrl, 0 )
if GetLastError() then print "band 0:"; r - l; " x"; b - tMicrosoft Learn: RB_GETRECT
sub GetBandBorders overload( byval hRebar as HWND, byval uBand as DWORD, byval prc as RECT ptr )
sub GetBandBorders overload( byval hRebar as HWND, byval uBand as DWORD, byref rc as RECT )
function GetBandBorders overload( byval hRebar as HWND, byval uBand as DWORD ) as ( long, long, long, long )Reads the borders of the band at index uBand: the space its gripper, label and edges take on
each side. These are thicknesses, not a rectangle: left is how far the child starts from the
band's left edge, and so on. Subtract them from GetRect for the area the child gets.
With RBS_BANDBORDERS all four are set; without it only left is.
Returns the four thicknesses as ( left, top, right, bottom ) (third form).
Example
var (bl, bt, br, bb) = Rebar.GetBandBorders( hCtrl, 0 )
print "the child starts"; bl; " pixels in"Microsoft Learn: RB_GETBANDBORDERS
sub GetBandMargins overload( byval hRebar as HWND, byval pMargins as MARGINS ptr )
sub GetBandMargins overload( byval hRebar as HWND, byref _margins as MARGINS )
function GetBandMargins overload( byval hRebar as HWND ) as MARGINSReads the margins the visual style puts around the child window of each band. Needs version 6 of the common controls.
Returns the margins (third form).
Example
dim m as MARGINS = Rebar.GetBandMargins( hCtrl )
print m.cxLeftWidth; m.cxRightWidth; m.cyTopHeight; m.cyBottomHeightMicrosoft Learn: RB_GETBANDMARGINS
function GetBarHeight( byval hRebar as HWND ) as DWORDReturns the height of the rebar in pixels, all its rows together. Use it to lay out the rest of the client area below the rebar.
Example
dim y as long = Rebar.GetBarHeight( hCtrl )
MoveWindow( GetDlgItem( hwnd, 200 ), 0, y, GetWindowClientWidth( hwnd ), GetWindowClientHeight( hwnd ) - y, CTRUE )Microsoft Learn: RB_GETBARHEIGHT
function GetRowCount( byval hRebar as HWND ) as DWORDReturns the number of rows of bands.
Example
print Rebar.GetRowCount( hCtrl ); " rows"Microsoft Learn: RB_GETROWCOUNT
function GetRowHeight( byval hRebar as HWND, byval uRow as DWORD ) as DWORDReturns the height in pixels of the row that holds the band at index uRow. Despite the
name, the number is a band index, not a row number.
Example
print "row of band 0:"; Rebar.GetRowHeight( hCtrl, 0 ); " pixels high"Microsoft Learn: RB_GETROWHEIGHT
function SizeToRect overload( byval hRebar as HWND, byval prc as RECT ptr ) as boolean
function SizeToRect overload( byval hRebar as HWND, byref rc as RECT ) as boolean
function SizeToRect overload( byval hRebar as HWND ) as ( long, long, long, long )Lays the bands out, wrapping them onto rows as needed, to fit as closely as it can the rectangle
given, in client coordinates of the parent. The third form passes an empty rectangle
(0, 0, 0, 0), returns it as ( left, top, right, bottom ) and leaves the message's result in
GetLastError(); with one band it was observed to change nothing and leave 0. Use one of the
first two.
Returns true when the layout changed (first two forms); the rectangle (third form).
Example
dim rc as RECT = ( 0, 0, 300, 80 )
if Rebar.SizeToRect( hCtrl, rc ) then print "bands rearranged"Microsoft Learn: RB_SIZETORECT
function HitTest( byval hRebar as HWND, byref rhbt as RBHITTESTINFO ) as longFinds the band at the point rhbt.pt, given in client coordinates of the rebar. The rebar fills
in iBand and, in flags, the part of the band the point is on: RBHT_CAPTION, RBHT_CLIENT,
RBHT_GRABBER, RBHT_CHEVRON or RBHT_NOWHERE.
Returns the index of the band at the point, or -1 when there is none.
Example
dim ht as RBHITTESTINFO
GetCursorPos( @ht.pt ) : ScreenToClient( hCtrl, @ht.pt )
if Rebar.HitTest( hCtrl, ht ) >= 0 andalso ht.flags = RBHT_GRABBER then print "on the gripper of band"; ht.iBandMicrosoft Learn: RB_HITTEST
function GetBarInfo overload( byval hRebar as HWND, byval prbi as REBARINFO ptr ) as boolean
function GetBarInfo overload( byval hRebar as HWND, byref rbi as REBARINFO ) as boolean
function GetBarInfo overload( byval hRebar as HWND ) as REBARINFOReads the rebar's image list (himl, asked for with RBIM_IMAGELIST in fMask): the images
bands show with RBBIM_IMAGE. cbSize is set for you. The third form sends fMask 0, so only
cbSize comes back set; use one of the first two.
Returns true on success (first two forms); the structure (third form).
Example
dim rbi as REBARINFO
rbi.fMask = RBIM_IMAGELIST
if Rebar.GetBarInfo( hCtrl, rbi ) andalso rbi.himl then print ImageList_GetImageCount( rbi.himl ); " images"Microsoft Learn: RB_GETBARINFO
function SetBarInfo overload( byval hRebar as HWND, byval prbi as REBARINFO ptr ) as boolean
function SetBarInfo overload( byval hRebar as HWND, byref rbi as REBARINFO ) as booleanGives the rebar an image list, with RBIM_IMAGELIST in fMask; cbSize is set for you. The
list stays yours to destroy, after the rebar.
Returns true on success.
Example
dim rbi as REBARINFO
rbi.fMask = RBIM_IMAGELIST
rbi.himl = ImageList_Create( 16, 16, ILC_COLOR32 or ILC_MASK, 4, 0 )
Rebar.SetBarInfo( hCtrl, rbi )Microsoft Learn: RB_SETBARINFO
function GetBkColor( byval hRebar as HWND ) as COLORREFReturns the background colour bands get when they do not set their own (RBBIM_COLORS).
A new rebar returns CLR_NONE (&hFFFFFFFF): the visual style or the system colour is used.
Example
if Rebar.GetBkColor( hCtrl ) = CLR_NONE then print "default background"Microsoft Learn: RB_GETBKCOLOR
function SetBkColor( byval hRebar as HWND, byval clrBk as DWORD ) as DWORDSets the default background colour of bands, a COLORREF. With visual styles active the theme
paints the bands and this colour may not show.
Returns the previous colour.
Example
Rebar.SetBkColor( hCtrl, RGB_OLDLACE )Microsoft Learn: RB_SETBKCOLOR
function GetTextColor( byval hRebar as HWND ) as COLORREFReturns the default colour of band labels; CLR_NONE in a new rebar.
Example
print hex( Rebar.GetTextColor( hCtrl ) )Microsoft Learn: RB_GETTEXTCOLOR
function SetTextColor( byval hRebar as HWND, byval clrText as COLORREF ) as COLORREFSets the default colour of band labels.
Returns the previous colour.
Example
Rebar.SetTextColor( hCtrl, RGB_NAVY )Microsoft Learn: RB_SETTEXTCOLOR
function GetColorScheme overload( byval hRebar as HWND, byval pcs as COLORSCHEME ptr ) as boolean
function GetColorScheme overload( byval hRebar as HWND, byref cs as COLORSCHEME ) as boolean
function GetColorScheme overload( byval hRebar as HWND ) as COLORSCHEMEReads the colours the rebar draws highlights and shadows with (clrBtnHighlight,
clrBtnShadow); dwSize is set for you. CLR_DEFAULT means the system colour. The second
form, taking the structure by reference, returns false at once and sends nothing: the
structure is left as it was. Use the first form with @cs, or the third.
Returns true on success (first form; the second always returns false); the colours (third
form).
Example
dim cs as COLORSCHEME
if Rebar.GetColorScheme( hCtrl, @cs ) then print hex( cs.clrBtnHighlight )
print hex( Rebar.GetColorScheme( hCtrl ).clrBtnShadow )Microsoft Learn: RB_GETCOLORSCHEME
sub SetColorScheme overload( byval hRebar as HWND, byval pcs as COLORSCHEME ptr )
sub SetColorScheme overload( byval hRebar as HWND, byref cs as COLORSCHEME )Sets the highlight and shadow colours; dwSize is set for you. The second form, taking the
structure by reference, returns at once and sends nothing, so the colours do not change; pass
@cs to the first form.
Example
dim cs as COLORSCHEME
cs.clrBtnHighlight = RGB_WHITE : cs.clrBtnShadow = RGB_GRAY
Rebar.SetColorScheme( hCtrl, @cs )Microsoft Learn: RB_SETCOLORSCHEME
function GetPalette( byval hRebar as HWND ) as HPALETTEReturns the palette the rebar draws with on a palette display, or NULL when it has none.
Example
dim hPal as HPALETTE = Rebar.GetPalette( hCtrl )Microsoft Learn: RB_GETPALETTE
function SetPalette( byval hRebar as HWND, byval hPal as HPALETTE ) as HPALETTESets the palette the rebar draws with.
Returns the previous palette, or NULL.
Example
dim hOld as HPALETTE = Rebar.SetPalette( hCtrl, GetStockObject( DEFAULT_PALETTE ) )Microsoft Learn: RB_SETPALETTE
function GetTooltips( byval hRebar as HWND ) as HWNDReturns the rebar's tooltip control, or NULL when it has none, as a new rebar made by
CWindow.AddControl does not.
Example
dim hTip as HWND = Rebar.GetTooltips( hCtrl )
if hTip = NULL then print "no tooltips"Microsoft Learn: RB_GETTOOLTIPS
sub SetTooltips( byval hRebar as HWND, byval hwndToolTip as HWND )Gives the rebar the tooltip control hwndToolTip.
Example
dim hTip as HWND = CreateWindowExW( 0, TOOLTIPS_CLASSW, NULL, TTS_ALWAYSTIP, 0, 0, 0, 0, hwnd, NULL, NULL, NULL )
Rebar.SetTooltips( hCtrl, hTip )Microsoft Learn: RB_SETTOOLTIPS
function SetParent( byval hRebar as HWND, byval hwndParent as HWND ) as HWNDSets the window that receives the rebar's notifications. The rebar's parent window, and where it is drawn, stay as they are.
Returns the previous notification window, or NULL.
Example
Rebar.SetParent( hCtrl, hwnd )Microsoft Learn: RB_SETPARENT
sub SetWindowTheme( byval hRebar as HWND, byval pwszTheme as wstring ptr )Gives the rebar the visual style named pwszTheme, for example "Explorer". Needs version 6 of
the common controls.
Example
Rebar.SetWindowTheme( hCtrl, "Explorer" )Microsoft Learn: RB_SETWINDOWTHEME
function SetDarkMode( byval hRebar as HWND ) as HRESULT
function RemoveDarkMode( byval hRebar as HWND ) as HRESULTSetDarkMode gives the rebar the dark theme of Explorer's navigation bar (DarkModeNavbar);
RemoveDarkMode gives it back its normal visual style. A toolbar in the rebar needs its own
ToolBar.SetDarkMode.
Returns S_OK on success, or an error code.
Example
if AppsUseDarkMode() then Rebar.SetDarkMode( hCtrl ) else Rebar.RemoveDarkMode( hCtrl )Microsoft Learn: SetWindowTheme
sub BeginDrag( byval hRebar as HWND, byval uBand as DWORD, byval dwPos as DWORD )
sub DragMove( byval hRebar as HWND, byval dwPos as DWORD )
sub EndDrag( byval hRebar as HWND )Drag a band from code, as the user does with the gripper. BeginDrag starts dragging the band at
index uBand; DragMove moves it; EndDrag drops it, without sending RBN_ENDDRAG. dwPos
packs a point in client coordinates of the rebar, x in the low word and y in the high word, or is
&hFFFFFFFF (-1) for the position of the last mouse message.
Example
Rebar.BeginDrag( hCtrl, 1, MAKELONG( 10, 5 ) )
Rebar.DragMove( hCtrl, MAKELONG( 140, 5 ) )
Rebar.EndDrag( hCtrl )Microsoft Learn: RB_BEGINDRAG
sub PushChevron( byval hRebar as HWND, byval uBand as DWORD, byval iAppValue as DWORD )Pushes the chevron of the band at index uBand as if it had been clicked, so that the rebar
sends its parent RBN_CHEVRONPUSHED, with iAppValue in the notification's lParamNM. The band
needs RBBS_USECHEVRON and a cxIdeal wider than it is shown.
Example
Rebar.PushChevron( hCtrl, 0, 0 )Microsoft Learn: RB_PUSHCHEVRON
function GetDropTarget( byval hRebar as HWND ) as IDropTarget ptrReturns the rebar's IDropTarget, the interface it uses when something is dragged over it.
Each call adds a reference: call Release on the pointer when done.
Example
dim pDropTarget as IDropTarget ptr = Rebar.GetDropTarget( hCtrl )
if pDropTarget then pDropTarget->lpVtbl->Release( pDropTarget )Microsoft Learn: RB_GETDROPTARGET
- sys/win/gui
- ToolBar for the toolbars that go in the bands
-
CWindow for
AddControl( "Rebar", ... ) - Combo and Edit for other band children
-
gui macros and helpers for reading
WM_COMMANDandWM_NOTIFY - Dark mode
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing