📄 uryxxframe.pas
字号:
unit uRyxxFrame;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, DBCtrls, wwdblook, ExtCtrls, StdCtrls, Mask,
wwdbdatetimepicker;
type
TFrameRyxx = class(TFrame)
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
DBEdit7: TDBEdit;
Label9: TLabel;
DBEdit8: TDBEdit;
Label10: TLabel;
Label11: TLabel;
DBEdit10: TDBEdit;
Label12: TLabel;
DBEdit11: TDBEdit;
Label13: TLabel;
DBEdit12: TDBEdit;
Label14: TLabel;
DBEdit13: TDBEdit;
Label8: TLabel;
DBEdit14: TDBEdit;
Label16: TLabel;
Label17: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
cmbFFFS: TwwDBLookupCombo;
cmbDJQK: TwwDBLookupCombo;
cmbHB: TwwDBLookupCombo;
cmbFFZQ: TwwDBLookupCombo;
cmbFFFS_Edit: TwwDBLookupCombo;
cmbDJQK_Edit: TwwDBLookupCombo;
cmbFFZQ_Edit: TwwDBLookupCombo;
souRYXX: TDataSource;
souFFFS: TDataSource;
qryFFFS: TQuery;
souDJQK: TDataSource;
qryDJQK: TQuery;
souFFZQ: TDataSource;
qryFFZQ: TQuery;
souFFJG: TDataSource;
qryFFJG: TQuery;
wwDBDateTimePicker1: TwwDBDateTimePicker;
souHB: TDataSource;
qryHB: TQuery;
cmbHB_Edit: TwwDBLookupCombo;
Label18: TLabel;
lblCount: TLabel;
cmbFFJGID: TwwDBLookupCombo;
cmbFFJGID_Edit: TwwDBLookupCombo;
procedure souRYXXDataChange(Sender: TObject; Field: TField);
procedure btnShowResultClick(Sender: TObject);
private
{ Private declarations }
procedure myComboEditExit(Sender: TObject);
procedure myComboEnter(Sender: TObject);
public
{ Public declarations }
procedure Start(AQuery: TDataSet); //显示
procedure Stop; //挂起
end;
implementation
uses uDwxx;
{$R *.DFM}
procedure TFrameRyxx.myComboEnter(Sender: TObject);
begin
//设置Combo Enter事件,
TwwDBLookupCombo(Self.FindComponent((Sender as TwwDBLookupCombo).Name +
'_Edit')).Visible := True;
TwwDBLookupCombo(Self.FindComponent((Sender as TwwDBLookupCombo).Name +
'_Edit')).Enabled := True;
TwwDBLookupCombo(Self.FindComponent((Sender as TwwDBLookupCombo).Name +
'_Edit')).SetFocus;
TwwDBLookupCombo(Self.FindComponent((Sender as TwwDBLookupCombo).Name +
'_Edit')).DropDown;
(Sender as TwwDBLookupCombo).Visible := False;
(Sender as TwwDBLookupCombo).Enabled := False;
end;
//适用于名字为cmbXXX_Edit之类的控件
procedure TFrameRyxx.myComboEditExit(Sender: TObject);
begin
//设置Combo Exit事件
(Sender as TwwDBLookupCombo).Visible := False;
(Sender as TwwDBLookupCombo).Enabled := False;
TwwDBLookupCombo(
Self.FindComponent(
Copy((Sender as TwwDBLookupCombo).Name, 1, Length((Sender as
TwwDBLookupCombo).Name) - 5)
)
).Visible := True;
TwwDBLookupCombo(
Self.FindComponent(
Copy((Sender as TwwDBLookupCombo).Name, 1, Length((Sender as
TwwDBLookupCombo).Name) - 5)
)
).Enabled := True;
end;
procedure TFrameRyxx.Start(AQuery: TDataSet);
//设置Combo属性和表现
procedure SetLookupCombo(ControlName: string);
begin
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Left :=
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Left;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Top :=
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Top;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Height :=
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Height;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Width :=
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Width;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Visible :=
False;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).Enabled :=
False;
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Visible := True;
(Self.FindComponent(ControlName) as TwwDBLookupCombo).Enabled := True;
(Self.FindComponent(ControlName) as TwwDBLookupCombo).OnEnter :=
myComboEnter;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).OnExit :=
myComboEditExit;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).TabOrder :=
(Self.FindComponent(ControlName) as TwwDBLookupCombo).TabOrder;
(Self.FindComponent(ControlName + '_Edit') as TwwDBLookupCombo).DropDownCount
:= 15;
end;
begin
souRyxx.DataSet := AQuery;
if not qryFFFS.Active then qryFFFS.Open;
if not qryFFZQ.Active then qryFFZQ.Open;
if not qryDJQK.Active then qryDJQK.Open;
if not qryHB.Active then qryHB.Open;
if not qryFFJG.Active then qryFFJG.Open;
SetLookupCombo('cmbFFFS'); //发放方式
SetLookupCombo('cmbDJQK'); //定居情况
SetLookupCombo('cmbHB'); //定居情况
SetLookupCombo('cmbFFZQ'); //上级单位代码
SetLookupCombo('cmbFFJGID'); //发放机构
end;
procedure TFrameRyxx.Stop;
begin
souFFZQ.DataSet := nil;
end;
procedure TFrameRyxx.souRYXXDataChange(Sender: TObject; Field: TField);
begin
if ((Sender as TDataSource).DataSet <> nil) and
(Sender as TDataSource).DataSet.Active then
lblCount.Caption := IntToStr((Sender as TDataSource).DataSet.RecordCount) +
'人';
end;
procedure TFrameRyxx.btnShowResultClick(Sender: TObject);
begin
//
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -