TBar

Fuente: source/classes/bar.prg

Inherits from: TControl

TBar is a button bar container that displays a horizontal or vertical strip of bitmap buttons with optional group separators. It supports multiple visual styles including flat 3D, Office 2007/2010/2013/2015 themes, GDI+ rendering, dark theme, and floating/dockable toolbars.

Key DATA Members

DATATypeDescription
nGroupsNumericNumber of button groups in the bar
nModeNumericDocking position: BAR_TOP(1), BAR_LEFT(2), BAR_RIGHT(3), BAR_DOWN(4), BAR_FLOAT(5)
nBtnWidthNumericButton width (default 28 pixels)
nBtnHeightNumericButton height (default 28 pixels)
l3DLogicalEnable 3D button borders
l2007LogicalOffice 2007 theme look
l2010LogicalOffice 2010 theme look
l2013LogicalOffice 2013 flat theme look
l2015LogicalOffice 2015 theme look
lGDIPLogicalEnable GDI+ rendering (read-only)
lBorderLogicalShow bar border
bClrGradCodeblockGradient color codeblock

Methods

MethodDescription
New( oWnd, nBtnW, nBtnH, l3D, cMode, oCursor, l2007, l2010, l2013, lBorder, oBrush, aGrad, nColor, lHScroll, l2015, nAlto, lGDIP, lDesign, cVarName )Create a new TBar attached to oWnd
NewAt( nRow, nCol, nWidth, nHeight, nBtnW, nBtnH, oWnd, l3D, cMode )Create a TBar at a specific position and size
Add( oBtnBmp, nPos )Add a TButtonBmp to the bar
AddGroup( nPos )Insert a visual group separator
Del( nPos, lRefresh )Remove a button from the bar
Adjust()Recalculate button positions and bar size
Float()Undock the bar into a floating window
GoDown() / GoLeft() / GoRight() / GoTop()Dock the bar to the specified edge
SetDarkTheme()Apply dark theme colors to the bar
SetGradients( aGrad, oBrush, nColor )Apply gradient background
Redefine( nId, oWnd, nWidth, nHeight, l2007, l2010, l2013, lBorder, l2015 )Redefine from dialog resource

Example: Top Bar with 3 Buttons

#include "FiveWin.ch"

function Main()

   local oWnd, oBar

   DEFINE WINDOW oWnd TITLE "Button Bar Demo" SIZE 600, 400

   oBar := TBar():New( oWnd, 32, 32,, "TOP" )

   oBar:Add( TButtonBmp():New(,, "New", oWnd,, 32, 32,,, .F., .F.,,,,, "new.bmp" ) )
   oBar:Add( TButtonBmp():New(,, "Open", oWnd,, 32, 32,,, .F., .F.,,,,, "open.bmp" ) )
   oBar:Add( TButtonBmp():New(,, "Save", oWnd,, 32, 32,,, .F., .F.,,,,, "save.bmp" ) )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Ver También