form notifies control of new role

git-svn-id: trunk@5650 -
This commit is contained in:
micha 2004-07-04 20:07:08 +00:00
parent 74330abee2
commit cb7c73a943
5 changed files with 45 additions and 16 deletions

View File

@ -81,6 +81,7 @@ type
procedure ExecuteDefaultAction; override;
procedure ExecuteCancelAction; override;
procedure SetRoleForForm(NewRole: TControlRoleForForm); override;
published
property Action;
property Anchors;
@ -333,6 +334,9 @@ end.
{ =============================================================================
$Log$
Revision 1.70 2004/07/04 20:07:08 micha
form notifies control of new role
Revision 1.69 2004/07/01 20:42:11 micha
implement better ExecuteXXAction design; break dependency on TButton class in TCustomForm

View File

@ -206,6 +206,8 @@ type
TBorderStyle = bsNone..bsSingle;
TControlBorderStyle = TBorderStyle;
TControlRoleForForm = (crffNormal, crffDefault, crffCancel);
TBevelCut = TGraphicsBevelCut;
TMouseButton = (mbLeft, mbRight, mbMiddle);
@ -1024,6 +1026,7 @@ type
procedure CheckNewParent(AParent: TWinControl); virtual;
procedure SendToBack;
procedure SetTempCursor(Value: TCursor);
procedure SetRoleForForm(NewRole: TControlRoleForForm); virtual;
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer;
@ -2334,6 +2337,9 @@ end.
{ =============================================================================
$Log$
Revision 1.223 2004/07/04 20:07:08 micha
form notifies control of new role
Revision 1.222 2004/07/03 14:59:42 mattias
fixed keydown geting all keys

View File

@ -96,6 +96,12 @@ begin
DoSendBtnDefault;
end;
procedure TButton.SetRoleForForm(NewRole: TControlRoleForForm);
begin
Default := NewRole = crffDefault;
Cancel := NewRole = crffCancel;
end;
{------------------------------------------------------------------------------
Method: TButton.SetCancel
Params: NewCancel - new cancel value
@ -210,6 +216,9 @@ end;
{ =============================================================================
$Log$
Revision 1.30 2004/07/04 20:07:08 micha
form notifies control of new role
Revision 1.29 2004/07/01 20:42:11 micha
implement better ExecuteXXAction design; break dependency on TButton class in TCustomForm

View File

@ -247,6 +247,10 @@ begin
Invalidate;
end;
procedure TControl.SetRoleForForm(NewRole: TControlRoleForForm);
begin
end;
procedure TControl.SetAction(Value: TBasicAction);
begin
if (Value=Action) then exit;
@ -3213,6 +3217,9 @@ end;
{ =============================================================================
$Log$
Revision 1.202 2004/07/04 20:07:08 micha
form notifies control of new role
Revision 1.201 2004/07/03 14:59:42 mattias
fixed keydown geting all keys

View File

@ -193,36 +193,36 @@ begin
end;
procedure TCustomForm.SetCancelControl(NewControl: TControl);
//var
// lControl: TControl;
var
lControl: TControl;
begin
if NewControl <> FCancelControl then
begin
// prevent inf. recursion problems
// lControl := FCancelControl;
// FCancelControl := nil;
// if lControl <> nil then
// (lControl as TControl).Cancel := false;
lControl := FCancelControl;
FCancelControl := nil;
if lControl <> nil then
lControl.SetRoleForForm(crffNormal);
FCancelControl := NewControl;
// if NewControl <> nil then
// (NewControl as TControl).Cancel := true;
if NewControl <> nil then
NewControl.SetRoleForForm(crffCancel);
end;
end;
procedure TCustomForm.SetDefaultControl(NewControl: TControl);
//var
// lControl: TControl;
var
lControl: TControl;
begin
if NewControl <> FDefaultControl then
begin
// prevent inf. recursion problems
// lControl := FDefaultControl;
// FDefaultControl := nil;
// if lControl <> nil then
// (lControl as TControl).Default := false;
lControl := FDefaultControl;
FDefaultControl := nil;
if lControl <> nil then
lControl.SetRoleForForm(crffNormal);
FDefaultControl := NewControl;
// if NewControl <> nil then
// (NewControl as TControl).Default := true;
if NewControl <> nil then
NewControl.SetRoleForForm(crffDefault);
end;
end;
@ -1641,6 +1641,9 @@ end;
{ =============================================================================
$Log$
Revision 1.143 2004/07/04 20:07:08 micha
form notifies control of new role
Revision 1.142 2004/07/01 20:42:11 micha
implement better ExecuteXXAction design; break dependency on TButton class in TCustomForm