谁能让 MDI 中的 ChildForm ShowModal(50分)

  • 主题发起人 主题发起人 xself
  • 开始时间 开始时间
X

xself

Unregistered / Unconfirmed
GUEST, unregistred user!
谁能让 MDI 中的子窗口 ShowModal
 
application.Mainform.enable:=false;
??? :)
 
application.Mainform.enable:=false; can't
 
好象不可以,我以前想这样作,都饶过去了,用一个普通窗口代替。
 
用一个普通窗口代替吧,反正效果是一样的。
 
谁能让 MDI 中的子窗口 ShowModal
想达到什么效果?

如果一定要参照如下代码:

{*******************************************************}
{ }
{ ComQuery User Interface Classes }
{ }
{ Author 笑傲江湖 } }
{ 1999,2000 NARI IS Corporation }
{ }
{*******************************************************}

unit CQUIClses;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ToolWin, StdCtrls, ExtCtrls;

type
TCQPropertyFormStyle = (pfNormal, pfDialog, pfNoCancelDialog, pfMDIChild, pfInside);

TCQPlusInfoFormClass = class of TCQPlusInfoForm;
TCQPlusInfoForm = class(TForm)
private
FPropertyFormStyle: TCQPropertyFormStyle;
protected
procedure CreateParams(var Params: TCreateParams); override;
public
constructor CustomCreate(AOwner: TComponent; AStyle: TCQPropertyFormStyle;
AParent: TWinControl; CustomData: array of const;
UseDefaultUI: Boolean = True); virtual;
constructor CustomCreateByID(AOwner: TComponent; AStyle: TCQPropertyFormStyle;
AParent: TWinControl; CustomData: array of const; AID: Integer;
UseDefaultUI: Boolean = True); virtual;
destructor Destroy; override;
procedure RefreshFormControlsData(ANode: TTreeNode); overload; virtual;
procedure RefreshFormControlsData(); overload; virtual;
property PropertyFormStyle: TCQPropertyFormStyle read FPropertyFormStyle;
end;

TCQQryUnitInfoFormClass = class of TCQQryUnitInfoForm;
TCQQryUnitInfoForm = class(TCQPlusInfoForm)
private
FSql: string;
FSqlCache: string;
FQryUnitID: Integer;
FQryAppID: Integer;
public
property Sql: string read FSql write FSql;
property SqlCache: string read FSqlCache write FSqlCache;
property QryUnitID: Integer read FQryUnitID write FQryUnitID;
property QryAppID: Integer read FQryAppID write FQryAppID;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;

{------------------------------------------------------------------------------}
implementation
{------------------------------------------------------------------------------}

constructor TCQPlusInfoForm.CustomCreate(AOwner: TComponent; AStyle: TCQPropertyFormStyle;
AParent: TWinControl; CustomData: array of const; UseDefaultUI: Boolean = True);
begin
FPropertyFormStyle := AStyle;
Create(AOwner);
case AStyle of
pfNormal :
begin
if FormStyle <> fsNormal then FormStyle := fsNormal;
if BorderStyle <> bsSizeable then BorderStyle := bsSizeable;
Position := poScreenCenter;
end;
pfDialog..pfNoCancelDialog :
begin
if FormStyle <> fsNormal then FormStyle := fsNormal;
if BorderStyle <> bsDialog then BorderStyle := bsDialog;
Position := poScreenCenter;
end;
pfMDIChild :
begin
if FormStyle <> fsMDIChild then FormStyle := fsMDIChild;
if BorderStyle <> bsSizeable then BorderStyle := bsSizeable;
Position := poDefault;
end;
pfInside :
begin
BorderStyle := bsNone;
if AParent <> nil then Parent := AParent;
Align := alClient;
end;
end;
if UseDefaultUI then
begin

end;
end;

constructor TCQPlusInfoForm.CustomCreateByID(AOwner: TComponent; AStyle: TCQPropertyFormStyle;
AParent: TWinControl; CustomData: array of const; AID: Integer;
UseDefaultUI: Boolean = True);
begin
CustomCreate(AOwner, AStyle, AParent, CustomData, UseDefaultUI);
end;

destructor TCQPlusInfoForm.Destroy;
begin
inherited;
end;

procedure TCQPlusInfoForm.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params) ;
if FPropertyFormStyle = pfInside then
with Params do
begin
Style := Style and (not WS_CAPTION) and (not WS_SYSMENU);
Style := (Style or WS_CHILD) and (not WS_POPUP) ;
Style := Style or WS_TABSTOP ;
end;
end;

procedure TCQPlusInfoForm.RefreshFormControlsData(ANode: TTreeNode);
begin

end;

procedure TCQPlusInfoForm.RefreshFormControlsData();
begin

end;

{------------------------------------------------------------------------------}
constructor TCQQryUnitInfoForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FSql := '';
FSqlCache := '';
FQryUnitID := -1;
FQryAppID := -1;
end;

destructor TCQQryUnitInfoForm.Destroy;
begin
inherited;
end;


end.

调用实现:
function CQCreateDialogForm(AOwner: TComponent;
AFormClass: TCQPlusInfoFormClass; AParent: TWinControl): TCQPlusInfoForm;
begin
Result := AFormClass.CustomCreate(AOwner, pfDialog, AParent, []);
try
Result.ShowModal;
except
on E: Exception do CQShowMessage(E.message);
end;
end;

function CQCreateInsideForm(AOwner: TComponent;
AFormClass: TCQPlusInfoFormClass; AParent: TWinControl;
AComponentList: TComponentList): TCQPlusInfoForm;
begin
Result := AFormClass.CustomCreate(AOwner, pfInside, AParent, []);
try
Result.Show;
AComponentList.Add(Result);
except
on E: Exception do CQShowMessage(E.message);
end;
end;

function CQCreateInsideFormNotShow(AOwner: TComponent;
AFormClass: TCQQryUnitInfoFormClass; AParent: TWinControl;
AComponentList: TComponentList): TCQQryUnitInfoForm;
begin
Result := AFormClass.CustomCreate(AOwner, pfInside, AParent, []);
try
//Result.Show;
AComponentList.Add(Result);
except
on E: Exception do CQShowMessage(E.message);
end;
end;

procedure CQCreateMDIChildForm(AOwner: TComponent;
AFormClass: TCQPlusInfoFormClass; AParent: TWinControl);
begin
AFormClass.CustomCreate(AOwner, pfMDIChild, AParent, []).Show;
end;

procedure CQCreateMDIChildForm(AOwner: TComponent;
AFormClass: TCQPlusInfoFormClass; AParent: TWinControl; AID: Integer);
begin
AFormClass.CustomCreateByID(AOwner, pfMDIChild, AParent, [], AID).Show;
end;



 
接受答案了.
 
后退
顶部