function NewToolbar( AParent: PControl; Align: TControlAlign; Options: TToolbarOptions; Bitmap: HBitmap; const Buttons: array of PKOLChar; const BtnImgIdxArray: array of Integer ): PControl;
Creates toolbar control. Bitmap (if present) must contain images for all buttons excluding separators (defined by string '-' in Buttons array) and system images, otherwise last buttons will no have images at all. Image width for every button is assumed to be equal to Bitmap height (if last of "squares" has insufficient width, it will not be used). To define fixed buttons, use characters '+' or '-' as a prefix for button string (even empty). To create groups of (radio-)buttons, use also '!' follow '+' or '-'. (These rules are similar used in menu creation). To define drop down button, use (as first) prefix '^'. (Do not forget to set OnTBDropDown event for this case). If You want to assign images to buttons not in the same order how these are placed in Bitmap (or You use system bitmap), define for every button (in BtnImgIdxArray array) indexes for every button (excluding separator buttons). Otherwise, it is possible to define index only for first button (e.g., [0]). It is also possible to change TBImages[ ] property for such purpose, or do the same in method TBSetBtnImgIdx).
Following properties, methods and event are specially designed to work with toolbar control:
property OnDropDown: TOnEvent; |
|
---|---|
property OnClick: TOnEvent; |
|
property OnTBDropDown: TOnEvent; |
|
property OnTBClick: TOnEvent; |
|
property OnTBCustomDraw: TOnTBCustomDraw; |
|
procedure TBAddBitmap( Bitmap: HBitmap ); |
|
function TBAddButtons( const Buttons: array of PKOLChar; const BtnImgIdxArray: array of Integer ): Integer; |
|
function TBInsertButtons( BeforeIdx: Integer; Buttons: array of PKOLChar; const BtnImgIdxArray: array of Integer ): Integer; |
|
procedure TBDeleteButton( BtnID: Integer ); |
|
procedure TBDeleteBtnByIdx( Idx: Integer ); |
|
procedure TBClear; |
|
procedure TBAssignEvents( BtnID: Integer; Events: array of TOnToolbarButtonClick ); |
|
procedure TBResetImgIdx( BtnID, BtnCount: Integer ); |
|
function TBItem2Index( BtnID: Integer ): Integer; |
|
function TBIndex2Item( Idx: Integer ): Integer; |
|
procedure TBConvertIdxArray2ID( const IdxVars: array of PDWORD ); |
|
function TBButtonSeparator( BtnID: Integer ): Boolean; |
|
function TBButtonAtPos( X, Y: Integer ): Integer; |
|
function TBBtnIdxAtPos( X, Y: Integer ): Integer; |
|
function TBMoveBtn( FromIdx, ToIdx: Integer ): Boolean; |
|
procedure TBSetTooltips( BtnID1st: Integer; const Tooltips: array of PKOLChar ); |
|
function TBBtnTooltip( BtnID: Integer ): KOLString; |
|
property CurIndex: Integer; |
|
property Count: Integer; |
|
property RightClick: Boolean; |
|
property TBCurItem: Integer; |
|
property TBButtonCount: Integer; |
|
property TBBtnImgWidth: Integer; |
|
property TBButtonEnabled[ BtnID: Integer ]: Boolean; |
|
property TBButtonVisible[ BtnID: Integer ]: Boolean; |
|
property TBButtonChecked[ BtnID: Integer ]: Boolean; |
|
property TBButtonMarked[ BtnID: Integer ]: Boolean; |
|
property TBButtonPressed[ BtnID: Integer ]: Boolean; |
|
property TBButtonText[ BtnID: Integer ]: KOLString; |
|
property TBButtonImage[ BtnID: Integer ]: Integer; |
|
property TBButtonRect[ BtnID: Integer ]: TRect; |
|
property TBButtonWidth[ BtnID: Integer ]: Integer; |
|
property TBButtonLParam[ const Idx: Integer ]: DWORD; |
|
property TBButtonsMinWidth: Integer; |
|
property TBButtonsMaxWidth: Integer; |
|
property TBRows: Integer; |