Class TTitleBarButtonEdit (unit CapBarEd) |
Inherits from
TDesignWindow
this is the form that is shown to the user when he clicks the
button for the button-property in the objectinspector
procedure But_AddClick(Sender: TObject);
add button
procedure But_ChangeClick(Sender: TObject);
swap from Left to Right and vice versa
procedure But_DelClick(Sender: TObject);
delete button
procedure But_ExitClick(Sender: TObject);
close button pressed
procedure But_UpDownClick(Sender: TObject);
set button one poition up or down, depending on the calling
object
function FindButton(Idx: integer;Align: TButAlign): TTitleButton;
returns button number IDX with alignment ALIGN,
returns NIL if nothing found
procedure FormClose(Sender: TObject; var Action: TCloseAction);
you have to define the FormClose-event in this way.
procedure FormCreate(Sender: TObject);
we have to create a TList-object to hold the list of buttons
procedure FormDestroy(Sender: TObject);
and also we have to destroy it when done
procedure FormShow(Sender: TObject);
***************************************************************
*** ***
*** procedures for the dialog ***
*** ***
*****************************************************************} { this is executed when the form is shown for the first time.
function GetFreeIndex: integer;
look for the lowest free indexvalue in buttonlist
function GetNewName: string;
get new name for component
function GetOwner: TComponent;
this returns the ownerform of the component.
procedure GridSelectCell(Sender: TObject; Col, Row: Longint;
var CanSelect: Boolean);
show the selected button in the objectinspector
procedure Grid_DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
draw a cell in a grid
procedure SetButtonFocus(But: TTitleButton);
sets the focus to the given button
procedure GetButtons(Sender: TObject);
find all buttons and create a list of them
procedure ReArrangeIndex;
the calling component recalculate indices of buttons.
property Buttons : TList
property Owner : TComponent
but_addleft : TSpeedButton;
But_AddRight : TSpeedButton;
But_Change : TSpeedButton;
But_DelLeft : TSpeedButton;
But_DelRight : TSpeedButton;
But_Down : TSpeedButton;
But_Exit : TSpeedButton;
But_Up : TSpeedButton;
Grid_Left : TStringGrid;
Grid_Right : TStringGrid;
Panel1 : TPanel;
Panel10 : TPanel;
Panel11 : TPanel;
Panel2 : TPanel;
Panel3 : TPanel;
Panel4 : TPanel;
Panel5 : TPanel;
Panel6 : TPanel;
Panel7 : TPanel;
Panel8 : TPanel;
Panel9 : TPanel;
FButName : TList;
FCaller : TTitleBar;
the list of buttons
procedure But_AddClick(Sender: TObject);
add button
procedure But_ChangeClick(Sender: TObject);
swap from Left to Right and vice versa
procedure But_DelClick(Sender: TObject);
delete button
procedure But_ExitClick(Sender: TObject);
close button pressed
procedure But_UpDownClick(Sender: TObject);
set button one poition up or down, depending on the calling
object
function FindButton(Idx: integer;Align: TButAlign): TTitleButton;
returns button number IDX with alignment ALIGN,
returns NIL if nothing found
procedure FormClose(Sender: TObject; var Action: TCloseAction);
you have to define the FormClose-event in this way. if you don't
do it then you will get a GPF in the DCL if you leave Delphi
procedure FormCreate(Sender: TObject);
we have to create a TList-object to hold the list of buttons
procedure FormDestroy(Sender: TObject);
and also we have to destroy it when done
procedure FormShow(Sender: TObject);
***************************************************************
*** ***
*** procedures for the dialog ***
*** ***
*****************************************************************} { this is executed when the form is shown for the first time.
function GetFreeIndex: integer;
look for the lowest free indexvalue in buttonlist
function GetNewName: string;
get new name for component
function GetOwner: TComponent;
this returns the ownerform of the component. the place where we
write our buttons to.
procedure GridSelectCell(Sender: TObject; Col, Row: Longint;
var CanSelect: Boolean);
show the selected button in the objectinspector
procedure Grid_DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
draw a cell in a grid
procedure SetButtonFocus(But: TTitleButton);
sets the focus to the given button
procedure GetButtons(Sender: TObject);
find all buttons and create a list of them
procedure ReArrangeIndex;
the calling component
recalculate indices of buttons. sometimes it can happen that the
indices of the buttons get mixed. so after getting the buttons
and showing them in the grids all indices are calculated from
the grids.
property Buttons : TList
property Owner : TComponent
but_addleft : TSpeedButton;
But_AddRight : TSpeedButton;
But_Change : TSpeedButton;
But_DelLeft : TSpeedButton;
But_DelRight : TSpeedButton;
But_Down : TSpeedButton;
But_Exit : TSpeedButton;
But_Up : TSpeedButton;
Grid_Left : TStringGrid;
Grid_Right : TStringGrid;
Panel1 : TPanel;
Panel10 : TPanel;
Panel11 : TPanel;
Panel2 : TPanel;
Panel3 : TPanel;
Panel4 : TPanel;
Panel5 : TPanel;
Panel6 : TPanel;
Panel7 : TPanel;
Panel8 : TPanel;
Panel9 : TPanel;
FButName : TList;
FCaller : TTitleBar;
the list of buttons