fsMDIChild = A (부모창)
fsNormal = B (팝업창)
부모창에서 팝업을 하나 띄운뒤 B창 텍스트박스 내용을 A창에 넣을려고 한는데..
잘 안되네요. 책보고 할려니 막혀서 답답해 죽겠습니다.
소스와 첨부 사진 도 같이 올립니다...
----------------------------------------------------------------------------------
unit UPdailyReport; <-- 부모창
<!--CodeS-->
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, URLabels, ExtCtrls, URGrids, URMGrid,
Buttons, ImgList, XPMenu, Menus, StdActns, ActnList, DB,
ZAbstractRODataset, ZAbstractDataset, ZDataset, ZConnection;
type
TfrmPdailyReport = class(TForm)
Panel1: TPanel;
wLabel1: TwLabel;
GroupBox1: TGroupBox;
Label2: TLabel;
metNoEdit: TEdit;
Label1: TLabel;
iDateTime: TDateTimePicker;
RealGrid1: TRealGrid;
closingBtn: TBitBtn;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ZConnection1: TZConnection;
ZQuery1: TZQuery;
DataSource1: TDataSource;
ZQuery2: TZQuery;
DataSource2: TDataSource;
ZQuery3: TZQuery;
DataSource3: TDataSource;
ActionList1: TActionList;
EditCut1: TEditCut;
EditCopy1: TEditCopy;
EditPaste1: TEditPaste;
EditUndo1: TEditUndo;
EditDelete1: TEditDelete;
SearchFind1: TSearchFind;
WindowClose1: TWindowClose;
PopupMenu1: TPopupMenu;
C1: TMenuItem;
V1: TMenuItem;
X3: TMenuItem;
N7: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N6: TMenuItem;
N8: TMenuItem;
X2: TMenuItem;
XPMenu1: TXPMenu;
ImageList1: TImageList;
procedure BitBtn2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
procedure popUpDaily;
public
{ Public declarations }
end;
var
frmPdailyReport: TfrmPdailyReport;
implementation
uses Main,UPdailyModal;
{$R *.dfm}
procedure TfrmPdailyReport.BitBtn2Click(Sender: TObject);
begin
popUpDaily;
end;
procedure TfrmPdailyReport.popUpDaily;
begin
frmDailyModal := TfrmDailyModal.Create(self);
frmDailyModal.ZQuery1.SQL.Text := 'Select * from Pmaster where ViewConf <> "D" and metNo like :metNo group by metNo order by metNo asc';
frmDailyModal.ZQuery1.ParamByName('metNo').AsString := '%'+metNoEdit.Text+'%';
frmDailyModal.ZQuery1.Open;
frmDailyModal.RealGrid1.Clear;
With frmDailyModal do begin
if not ZQuery1.IsEmpty then
While NOT ZQuery1.EOF do
begin
RealGrid1.AddRow;
RealGrid1.Cells[0 , RealGrid1.RowCount -1].AsInteger := ZQuery1.FieldByName('no').AsInteger;
RealGrid1.Cells[1 , RealGrid1.RowCount -1].AsString := ZQuery1.FieldByName('metNo').AsString;
RealGrid1.Cells[2 , RealGrid1.RowCount -1].AsString := ZQuery1.FieldByName('regdate').AsString;
RealGrid1.Cells[2 , RealGrid1.RowCount -1].AsString := ZQuery1.FieldByName('detail').AsString;
ZQuery1.Next;
end;
show;
end;
end;
procedure TfrmPdailyReport.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
end.
--------------------------------------------------------------------------------
<!-- CodeS-->
unit UPdailyModal; (팝업창)
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, URLabels, ExtCtrls, URGrids, URMGrid, ImgList, XPMenu, Menus,
StdActns, ActnList, DB, ZAbstractRODataset, ZAbstractDataset, ZDataset,
ZConnection, StdCtrls;
type
TfrmDailyModal = class(TForm)
Panel1: TPanel;
wLabel1: TwLabel;
RealGrid1: TRealGrid;
ZConnection1: TZConnection;
ZQuery1: TZQuery;
DataSource1: TDataSource;
ZQuery2: TZQuery;
DataSource2: TDataSource;
ZQuery3: TZQuery;
DataSource3: TDataSource;
ActionList1: TActionList;
EditCut1: TEditCut;
EditCopy1: TEditCopy;
EditPaste1: TEditPaste;
EditUndo1: TEditUndo;
EditDelete1: TEditDelete;
SearchFind1: TSearchFind;
WindowClose1: TWindowClose;
PopupMenu1: TPopupMenu;
C1: TMenuItem;
V1: TMenuItem;
X3: TMenuItem;
N7: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N6: TMenuItem;
N8: TMenuItem;
X2: TMenuItem;
XPMenu1: TXPMenu;
ImageList1: TImageList;
Edit1: TEdit;
procedure RealGrid1EditButtonClick(AColumn: TwColumn);
private
{ Private declarations }
procedure InsertGrid;
public
{ Public declarations }
end;
var
frmDailyModal: TfrmDailyModal;
implementation
uses Main,UPdailyReport;
{$R *.dfm}
procedure TfrmDailyModal.InsertGrid;
var
num : integer;
begin
frmPdailyReport.metNoEdit.Text := Edit1.Text;
Close;
end;
procedure TfrmDailyModal.RealGrid1EditButtonClick(AColumn: TwColumn);
begin
InsertGrid;
end;
end.
<!--CodeE-->
frmSample.Show; 는 Modaless form 입니다.
frmSample.ShowModal; 이 Modal 로 띄우는 겁니다..
Modal 로 띄우면 에러가 없을 겁니다..
수고하세여.