起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 436|回复: 3

[求助]窗体显示**

[复制链接]
匿名  发表于 2007-2-7 10:26:51 |阅读模式
请问在打开多个功能窗体后,在其中一个窗体中怎么用代码去判断当前显示的是否是该窗体?
在切换上方的功能标签(如下图)时功能窗体中触发甚么事件?

aa.jpg

4.9 KB, 下载次数: 219

回复

使用道具

发表于 2007-2-7 11:00:49 | 显示全部楼层
当窗体切换时候,切换走,切换回来,都触发OnConstrainedResize事件
而且在窗体改变大小,业务功能树打开,收缩时候,在第一次显示窗体时候,都会出发OnConstrainedResize事件,而且都是触发多次OnConstrainedResize事件
回复 支持 反对

使用道具 举报

发表于 2007-2-7 11:01:19 | 显示全部楼层
你可以用以下代码测试各种事件的出发时机
==========================
unit MainForm;

interface

uses
  Business.System, Business.Forms, Business.Data, Business.Model;

type
  TMainForm = class(TForm)
    DataSetBZSJJ1: TSQLDataSet;
    DataEdit1: TDataEdit;
    DataSource1: TDataSource;
    DataEdit2: TDataEdit;
    DataEdit3: TDataEdit;
    DataEdit4: TDataEdit;
    Button1: TButton;
    Button2: TButton;
    DataGrid1: TDataGrid;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure BizFormActivate(Sender: TObject);
    procedure BizFormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean);
    procedure BizFormClick(Sender: TObject);
    procedure BizFormClose(Sender: TObject; var Action: TCloseAction);
    procedure BizFormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure BizFormConstrainedResize(Sender: TObject; var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer);
    procedure BizFormContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
    procedure BizFormCreate(Sender: TObject);
    procedure BizFormDblClick(Sender: TObject);
    procedure BizFormDeactivate(Sender: TObject);
    procedure BizFormDestroy(Sender: TObject);
    procedure BizFormDockDrop(Sender: TObject; Source: TDragDockObject; X, Y: Integer);
    procedure BizFormDockOver(Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
    procedure BizFormDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure BizFormDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
    procedure BizFormEndDock(Sender, Target: TObject; X, Y: Integer);
    procedure BizFormGetSiteInfo(Sender: TObject; DockClient: TControl; var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
    function BizFormHelp(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;
    procedure BizFormHide(Sender: TObject);
    procedure BizFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure BizFormKeyPress(Sender: TObject; var Key: Char);
    procedure BizFormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure BizFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure BizFormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure BizFormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure BizFormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    procedure BizFormMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
    procedure BizFormMouseWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
    procedure BizFormPaint(Sender: TObject);
    procedure BizFormResize(Sender: TObject);
//    procedure BizFormShortCut(var Msg: TWMKey; var Handled: Boolean);
    procedure BizFormShow(Sender: TObject);
    procedure BizFormStartDock(Sender: TObject; var DragObject: TDragDockObject);
    procedure BizFormUnDock(Sender: TObject; Client: TControl; NewTarget: TWinControl; var Allow: Boolean);
  private
    {private declarations}
  public
    {public declarations}
  end;

implementation


procedure TMainForm.Button1Click(Sender: TObject);
begin
  DataSetBZSJJ1.RefreshRecord;
end;

procedure TMainForm.Button2Click(Sender: TObject);
begin
  DataSetBZSJJ1.Open;
end;

procedure TMainForm.BizFormActivate(Sender: TObject);
begin
  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean);
begin
  Dialogs.Showmessage('OnCanResize');
end;

procedure TMainForm.BizFormClick(Sender: TObject);
begin
  Dialogs.Showmessage('OnClick');
end;

procedure TMainForm.BizFormClose(Sender: TObject; var Action: TCloseAction);
begin
  Dialogs.Showmessage('OnClose');
end;

procedure TMainForm.BizFormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  Dialogs.Showmessage('OnCloseQuery');
end;

procedure TMainForm.BizFormConstrainedResize(Sender: TObject; var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer);
begin
  Dialogs.Showmessage('OnConstrainedResize');
end;

procedure TMainForm.BizFormContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormCreate(Sender: TObject);
begin
  Dialogs.Showmessage('OnCreate');
end;

procedure TMainForm.BizFormDblClick(Sender: TObject);
begin
  Dialogs.Showmessage('OnDblClick');
end;

procedure TMainForm.BizFormDeactivate(Sender: TObject);
begin
  Dialogs.Showmessage('OnDeactivate');
end;

procedure TMainForm.BizFormDestroy(Sender: TObject);
begin
  Dialogs.Showmessage('OnDestroy');
end;

procedure TMainForm.BizFormDockDrop(Sender: TObject; Source: TDragDockObject; X, Y: Integer);
begin
  Dialogs.Showmessage('OnDockDrop');
end;

procedure TMainForm.BizFormDockOver(Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
  Dialogs.Showmessage('OnDockOver');
end;

procedure TMainForm.BizFormDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
  Dialogs.Showmessage('OnDragDrop');
end;

procedure TMainForm.BizFormDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
  Dialogs.Showmessage('OnDragOver');
end;

procedure TMainForm.BizFormEndDock(Sender, Target: TObject; X, Y: Integer);
begin
  Dialogs.Showmessage('OnEndDock');
end;

procedure TMainForm.BizFormGetSiteInfo(Sender: TObject; DockClient: TControl; var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
begin
  Dialogs.Showmessage('OnGetSiteInfo');
end;

function TMainForm.BizFormHelp(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;
begin
  Dialogs.Showmessage('OnHelp');
end;

procedure TMainForm.BizFormHide(Sender: TObject);
begin
  Dialogs.Showmessage('OnHide');
end;

procedure TMainForm.BizFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormKeyPress(Sender: TObject; var Key: Char);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormMouseWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormPaint(Sender: TObject);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormResize(Sender: TObject);
begin
  Dialogs.Showmessage('OnResize');
end;

{procedure TMainForm.BizFormShortCut(var Msg: TWMKey; var Handled: Boolean);
begin
  Dialogs.Showmessage('OnShortCut');
end;
}
procedure TMainForm.BizFormShow(Sender: TObject);
begin
  Dialogs.Showmessage('OnShow');
end;

procedure TMainForm.BizFormStartDock(Sender: TObject; var DragObject: TDragDockObject);
begin
//  Dialogs.Showmessage('OnActivate');
end;

procedure TMainForm.BizFormUnDock(Sender: TObject; Client: TControl; NewTarget: TWinControl; var Allow: Boolean);
begin
//  Dialogs.Showmessage('OnActivate');
end;

end.
回复 支持 反对

使用道具 举报

匿名  发表于 2007-2-7 11:32:40
OK,谢谢alang!
回去试一下了。^_^
回复 支持 反对

使用道具

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2024-12-24 21:59 , Processed in 0.040239 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表