implemented designer close query

git-svn-id: trunk@4180 -
This commit is contained in:
mattias 2003-05-24 08:51:41 +00:00
parent 47da6432fb
commit 54b361fc68
2 changed files with 52 additions and 35 deletions

View File

@ -341,24 +341,6 @@ type
procedure WndProc(var TheMessage : TLMessage); override;
public
// properties
property ActiveControl : TWinControl read FActiveControl write SetActiveControl;
property Icon: TIcon read FIcon write SetIcon stored IsIconStored;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnClose: TCloseEvent read FOnClose write FOnClose stored IsForm;
property OnCloseQuery : TCloseQueryEvent
read FOnCloseQuery write FOnCloseQuery stored IsForm;
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnHelp: THelpEvent read FOnHelp write FOnHelp;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnResize stored IsForm;
property OnWindowStateChanged: TNotifyEvent
read fOnWindowStateChanged write fOnWindowStateChanged;
property Position : TPosition read FPosition write SetPosition default poDesigned;
property TextHeight : Longint read FDummyTextHeight write FDummyTextHeight
stored False;
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Num : Integer); virtual;
@ -368,27 +350,50 @@ type
procedure Close;
procedure Release;
procedure Hide;
procedure Show;
procedure ShowOnTop;
function WantChildKey(Child : TControl;
var Message : TLMessage): Boolean; virtual;
var Message : TLMessage): Boolean; virtual;
procedure SetFocus; override;
function SetFocusedControl(Control: TWinControl): Boolean ; Virtual;
procedure FocusControl(WinControl: TWinControl);
function ShowModal : Integer;
public
property Active: Boolean read FActive;
property BorderStyle : TFormBorderStyle
read FBorderStyle write SetBorderStyle default bsSizeable;
property ActiveControl: TWinControl read FActiveControl write SetActiveControl;
property BorderStyle: TFormBorderStyle
read FBorderStyle write SetBorderStyle default bsSizeable;
property Caption stored IsForm;
property Designer : TIDesigner read FDesigner write SetDesigner;
property FormStyle : TFormStyle read FFormStyle write SetFormStyle default fsNormal;
property FormState : TFormState read FFormState;
property HelpFile: string read FHelpFile write FHelpFile stored IsHelpFileStored;
property KeyPreview: Boolean read FKeyPreview write FKeyPreview stored IsKeyPreviewStored;
property Designer: TIDesigner read FDesigner write SetDesigner;
property FormState: TFormState read FFormState;
property FormStyle: TFormStyle read FFormStyle write SetFormStyle
default fsNormal;
property HelpFile: string read FHelpFile write FHelpFile
stored IsHelpFileStored;
property Icon: TIcon read FIcon write SetIcon stored IsIconStored;
property KeyPreview: Boolean read FKeyPreview write FKeyPreview
stored IsKeyPreviewStored;
property Menu : TMainMenu read FMenu write SetMenu;
property ModalResult : TModalResult read FModalResult write SetModalResult;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnClose: TCloseEvent read FOnClose write FOnClose stored IsForm;
property OnCloseQuery : TCloseQueryEvent
read FOnCloseQuery write FOnCloseQuery stored IsForm;
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnHelp: THelpEvent read FOnHelp write FOnHelp;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
property OnResize stored IsForm;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnWindowStateChanged: TNotifyEvent
read fOnWindowStateChanged write fOnWindowStateChanged;
property Position: TPosition read FPosition write SetPosition default poDesigned;
property TextHeight: Longint read FDummyTextHeight write FDummyTextHeight
stored False;
property Visible write SetVisible default False;
property WindowState: TWindowState read FWindowState write SetWindowState
default wsNormal;
default wsNormal;
end;

View File

@ -267,19 +267,19 @@ end;
------------------------------------------------------------------------------}
Procedure TCustomForm.SetVisible(Value : boolean);
Begin
//writeln('[TCustomForm.SetVisible] START2 ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',FormUpdating);
//writeln('[TCustomForm.SetVisible] START ',Name,':',ClassName,' Old=',Visible,' New=',Value,' ',(fsCreating in FFormState),' ',FormUpdating);
if Value then
Include(FFormState, fsVisible)
else
Exclude(FFormState, fsVisible);
//writeln('TCustomForm.SetVisible ',Name,':',ClassName,' ',FormUpdating);
//writeln('TCustomForm.SetVisible ',Name,':',ClassName,' ',FormUpdating);
if (fsCreating in FFormState) {or FormUpdating} then
// will be done when finished loading
else
begin
inherited Visible := Value;
inherited Visible:=Value;
end;
//writeln('[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',FormUpdating);
//writeln('[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',FormUpdating);
end;
{------------------------------------------------------------------------------
@ -1061,26 +1061,26 @@ end;
{------------------------------------------------------------------------------
TCustomForm Method CloseQuery
------------------------------------------------------------------------------}
function TCustomForm.CloseQuery : boolean;
function TCustomForm.CloseQuery: boolean;
//var i : integer;
begin
{ Query children forms whether we can close }
if FormStyle = fsMDIForm then begin
{ for i:= 0 to MDIChildCount - 1 do begin
{ for i:= 0 to MDIChildCount - 1 do begin
if not MDIChildren[i].CloseQuery then begin
Result:= false;
Exit;
end;
end;}
end;
Result:= true;
Result := true;
if Assigned(FOnCloseQuery) then FOnCloseQuery(Self, Result);
end;
{------------------------------------------------------------------------------}
{ TCustomForm Method WMCloseQuery }
{------------------------------------------------------------------------------}
procedure TCustomForm.WMCloseQuery(var Message : TLMessage);
procedure TCustomForm.WMCloseQuery(var Message: TLMessage);
begin
Close;
{ Always return 0, because we destroy the window ourselves }
@ -1097,6 +1097,14 @@ begin
Visible := False;
end;
{------------------------------------------------------------------------------
procedure TCustomForm.Show;
------------------------------------------------------------------------------}
procedure TCustomForm.Show;
begin
Visible:=true;
end;
{------------------------------------------------------------------------------
procedure TCustomForm.ShowOnTop;
------------------------------------------------------------------------------}
@ -1104,6 +1112,7 @@ procedure TCustomForm.ShowOnTop;
begin
Show;
BringToFront;
//writeln('TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState);
LCLLinux.ShowWindow(Handle,SW_SHOWNORMAL);
end;
@ -1417,6 +1426,9 @@ end;
{ =============================================================================
$Log$
Revision 1.99 2003/05/24 08:51:41 mattias
implemented designer close query
Revision 1.98 2003/05/12 13:40:50 mattias
fixed clsing popupmenu on showmodal