TReBar
Fuente: source/classes/rebar.prg
Inherits from: TControl
TReBar wraps the Windows rebar / coolbar common control to create a container that hosts multiple child windows in resizable bands. Each band can contain a toolbar, a combobox, or any other control, and can be rearranged or resized by the user at runtime via a gripper bar at the left edge of each band.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
aBands | Array | Array of band definitions (controls and text) |
Methods
| Method | Description |
|---|---|
New( oWnd ) | Create a new TReBar control attached to a window |
InsertBand( oControl, cText ) | Insert a new band containing oControl with optional caption text |
Example: Rebar with Two Toolbar Bands
#include "FiveWin.ch"
function Main()
local oWnd, oReBar, oBar1, oBar2
DEFINE WINDOW oWnd TITLE "ReBar Demo" SIZE 600, 400
oReBar := TReBar():New( oWnd )
DEFINE BUTTONBAR oBar1 _3D OF oWnd SIZE 30, 30
DEFINE BUTTON OF oBar1 RESOURCE "new.bmp" ACTION MsgInfo( "New" )
DEFINE BUTTON OF oBar1 RESOURCE "open.bmp" ACTION MsgInfo( "Open" )
DEFINE BUTTON OF oBar1 RESOURCE "save.bmp" ACTION MsgInfo( "Save" )
DEFINE BUTTONBAR oBar2 _3D OF oWnd SIZE 30, 30
DEFINE BUTTON OF oBar2 RESOURCE "cut.bmp" ACTION MsgInfo( "Cut" )
DEFINE BUTTON OF oBar2 RESOURCE "copy.bmp" ACTION MsgInfo( "Copy" )
DEFINE BUTTON OF oBar2 RESOURCE "paste.bmp" ACTION MsgInfo( "Paste" )
oReBar:InsertBand( oBar1, "File" )
oReBar:InsertBand( oBar2, "Edit" )
oWnd:oClient := oReBar
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- Each band in the rebar displays a gripper on the left side, allowing the user to drag and reorder bands at runtime.
- Bands can also be resized by dragging the right edge of the band's caption area.
- The
cTextparameter inInsertBand()becomes the band's caption/label text, displayed to the left of the embedded control. - Setting
oWnd:oClient := oReBarmakes the rebar span the full width of the window below the menu and above the client area. - TReBar is ideal for applications that offer multiple customizable toolbars in a compact, space-efficient layout.