主窗体代码 :
procedure THTFKJTZ.Button1Click(Sender: TObject);
var
lForm: HTJBXX.THTXX;
begin
lForm := HTJBXX.THTXX.Create(Self.Context);
try
lForm.lStr := FK.DataSet.FieldByName('YHTBH').AsString;
lForm.ShowModal;
finally
lForm.Free;
end;
end;
被调用窗体的代码:
unit HTXX;
interface
uses
Business.System, Business.Model, Business.Forms, Business.Data, Business.Model;
type
THTXX = class(TForm)
FuncBroker: TFuncBroker;
InfoBrokerHTXX: TInfoBroker;
ControlBar: TControlBar;
DataNavigator: TDataNavigator;
DocViewBar: TDocViewBar;
PageControl: TPageControl;
TabSheet: TTabSheet;
DocViewHTXX_HTBD: TDocView;
TabSheet1: TTabSheet;
DocViewHTXX_XMXXB: TDocView;
DataSetBroker1: TDataSetBroker;
procedure DocViewHTXX_HTBDOpen(Sender: TObject);
private
{private declarations}
public
{public declarations}
lStr : String;
end;
implementation
procedure THTXX.DocViewHTXX_HTBDOpen(Sender: TObject);
begin
if lStr <> '' then
begin
//过滤出FID为lStr数值的数据
DataSetBroker1.DataSet.Filtered := False;
DataSetBroker1.DataSet.Filter := ' HTBH = ''' + lStr + '''';
DataSetBroker1.DataSet.Filtered := True;
end;
end;
end. |