....ㅜㅜ
부모폼에서 자식폼을 연후에 자식폼에서 확인 버튼을 누르면 label3의 caption 을 부모폼의 label15.caption 으로 전송 하고 싶습니다. !!~
참고로 부모폼은 ACTIVEX폼입니당 !~
어떻게 하면 될까요 ㅜㅜ
--- 부모폼 소스 ---
unit Download;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ActiveX, AxCtrls, IeDownLoad_TLB, StdVcl, ExtCtrls, StdCtrls, ComCtrls;
type
TACTF1 = class(TActiveForm, IACTF1)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
ProgressBar1: TProgressBar;
GroupBox2: TGroupBox;
Label10: TLabel;
Label11: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox3: TGroupBox;
Label12: TLabel;
Label13: TLabel;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
GroupBox4: TGroupBox;
Label15: TLabel;
Label14: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
FEvents: IACTF1Events;
procedure ActivateEvent(Sender: TObject);
procedure ClickEvent(Sender: TObject);
procedure CreateEvent(Sender: TObject);
procedure DblClickEvent(Sender: TObject);
procedure DeactivateEvent(Sender: TObject);
procedure DestroyEvent(Sender: TObject);
procedure KeyPressEvent(Sender: TObject; var Key: Char);
procedure PaintEvent(Sender: TObject);
protected
{ Protected declarations }
procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
procedure EventSinkChanged(const EventSink: IUnknown); override;
function Get_Active: WordBool; safecall;
function Get_AlignDisabled: WordBool; safecall;
function Get_AutoScroll: WordBool; safecall;
function Get_AutoSize: WordBool; safecall;
function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
function Get_Caption: WideString; safecall;
function Get_Color: OLE_COLOR; safecall;
function Get_DoubleBuffered: WordBool; safecall;
function Get_DropTarget: WordBool; safecall;
function Get_Enabled: WordBool; safecall;
function Get_Font: IFontDisp; safecall;
function Get_HelpFile: WideString; safecall;
function Get_KeyPreview: WordBool; safecall;
function Get_PixelsPerInch: Integer; safecall;
function Get_PrintScale: TxPrintScale; safecall;
function Get_Scaled: WordBool; safecall;
function Get_ScreenSnap: WordBool; safecall;
function Get_SnapBuffer: Integer; safecall;
function Get_Visible: WordBool; safecall;
function Get_VisibleDockClientCount: Integer; safecall;
procedure _Set_Font(var Value: IFontDisp); safecall;
procedure Set_AutoScroll(Value: WordBool); safecall;
procedure Set_AutoSize(Value: WordBool); safecall;
procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
procedure Set_Caption(const Value: WideString); safecall;
procedure Set_Color(Value: OLE_COLOR); safecall;
procedure Set_DoubleBuffered(Value: WordBool); safecall;
procedure Set_DropTarget(Value: WordBool); safecall;
procedure Set_Enabled(Value: WordBool); safecall;
procedure Set_Font(const Value: IFontDisp); safecall;
procedure Set_HelpFile(const Value: WideString); safecall;
procedure Set_KeyPreview(Value: WordBool); safecall;
procedure Set_PixelsPerInch(Value: Integer); safecall;
procedure Set_PrintScale(Value: TxPrintScale); safecall;
procedure Set_Scaled(Value: WordBool); safecall;
procedure Set_ScreenSnap(Value: WordBool); safecall;
procedure Set_SnapBuffer(Value: Integer); safecall;
procedure Set_Visible(Value: WordBool); safecall;
public
{ Public declarations }
procedure Initialize; override;
end;
var
ACTF1 : TACTF1;
ACTF1_Lable15 : TLABEL;
implementation
uses ComObj, ComServ, Download2;
{$R *.DFM}
{ TACTF1 }
procedure TACTF1.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
begin
{ Define property pages here. Property pages are defined by calling
DefinePropertyPage with the class id of the page. For example,
DefinePropertyPage(Class_ACTF1Page); }
end;
procedure TACTF1.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IACTF1Events;
inherited EventSinkChanged(EventSink);
end;
procedure TACTF1.Initialize;
begin
inherited Initialize;
OnActivate := ActivateEvent;
OnClick := ClickEvent;
OnCreate := CreateEvent;
OnDblClick := DblClickEvent;
OnDeactivate := DeactivateEvent;
OnDestroy := DestroyEvent;
OnKeyPress := KeyPressEvent;
OnPaint := PaintEvent;
end;
function TACTF1.Get_Active: WordBool;
begin
Result := Active;
end;
function TACTF1.Get_AlignDisabled: WordBool;
begin
Result := AlignDisabled;
end;
function TACTF1.Get_AutoScroll: WordBool;
begin
Result := AutoScroll;
end;
function TACTF1.Get_AutoSize: WordBool;
begin
Result := AutoSize;
end;
function TACTF1.Get_AxBorderStyle: TxActiveFormBorderStyle;
begin
Result := Ord(AxBorderStyle);
end;
function TACTF1.Get_Caption: WideString;
begin
Result := WideString(Caption);
end;
function TACTF1.Get_Color: OLE_COLOR;
begin
Result := OLE_COLOR(Color);
end;
function TACTF1.Get_DoubleBuffered: WordBool;
begin
Result := DoubleBuffered;
end;
function TACTF1.Get_DropTarget: WordBool;
begin
Result := DropTarget;
end;
function TACTF1.Get_Enabled: WordBool;
begin
Result := Enabled;
end;
function TACTF1.Get_Font: IFontDisp;
begin
GetOleFont(Font, Result);
end;
function TACTF1.Get_HelpFile: WideString;
begin
Result := WideString(HelpFile);
end;
function TACTF1.Get_KeyPreview: WordBool;
begin
Result := KeyPreview;
end;
function TACTF1.Get_PixelsPerInch: Integer;
begin
Result := PixelsPerInch;
end;
function TACTF1.Get_PrintScale: TxPrintScale;
begin
Result := Ord(PrintScale);
end;
function TACTF1.Get_Scaled: WordBool;
begin
Result := Scaled;
end;
function TACTF1.Get_ScreenSnap: WordBool;
begin
Result := ScreenSnap;
end;
function TACTF1.Get_SnapBuffer: Integer;
begin
Result := SnapBuffer;
end;
function TACTF1.Get_Visible: WordBool;
begin
Result := Visible;
end;
function TACTF1.Get_VisibleDockClientCount: Integer;
begin
Result := VisibleDockClientCount;
end;
procedure TACTF1._Set_Font(var Value: IFontDisp);
begin
SetOleFont(Font, Value);
end;
procedure TACTF1.ActivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnActivate;
end;
procedure TACTF1.ClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnClick;
end;
procedure TACTF1.CreateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnCreate;
end;
procedure TACTF1.DblClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDblClick;
end;
procedure TACTF1.DeactivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDeactivate;
end;
procedure TACTF1.DestroyEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDestroy;
end;
procedure TACTF1.KeyPressEvent(Sender: TObject; var Key: Char);
var
TempKey: Smallint;
begin
TempKey := Smallint(Key);
if FEvents <> nil then FEvents.OnKeyPress(TempKey);
Key := Char(TempKey);
end;
procedure TACTF1.PaintEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnPaint;
end;
procedure TACTF1.Set_AutoScroll(Value: WordBool);
begin
AutoScroll := Value;
end;
procedure TACTF1.Set_AutoSize(Value: WordBool);
begin
AutoSize := Value;
end;
procedure TACTF1.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
begin
AxBorderStyle := TActiveFormBorderStyle(Value);
end;
procedure TACTF1.Set_Caption(const Value: WideString);
begin
Caption := TCaption(Value);
end;
procedure TACTF1.Set_Color(Value: OLE_COLOR);
begin
Color := TColor(Value);
end;
procedure TACTF1.Set_DoubleBuffered(Value: WordBool);
begin
DoubleBuffered := Value;
end;
procedure TACTF1.Set_DropTarget(Value: WordBool);
begin
DropTarget := Value;
end;
procedure TACTF1.Set_Enabled(Value: WordBool);
begin
Enabled := Value;
end;
procedure TACTF1.Set_Font(const Value: IFontDisp);
begin
SetOleFont(Font, Value);
end;
procedure TACTF1.Set_HelpFile(const Value: WideString);
begin
HelpFile := String(Value);
end;
procedure TACTF1.Set_KeyPreview(Value: WordBool);
begin
KeyPreview := Value;
end;
procedure TACTF1.Set_PixelsPerInch(Value: Integer);
begin
PixelsPerInch := Value;
end;
procedure TACTF1.Set_PrintScale(Value: TxPrintScale);
begin
PrintScale := TPrintScale(Value);
end;
procedure TACTF1.Set_Scaled(Value: WordBool);
begin
Scaled := Value;
end;
procedure TACTF1.Set_ScreenSnap(Value: WordBool);
begin
ScreenSnap := Value;
end;
procedure TACTF1.Set_SnapBuffer(Value: Integer);
begin
SnapBuffer := Value;
end;
procedure TACTF1.Set_Visible(Value: WordBool);
begin
Visible := Value;
end;
procedure TACTF1.Button1Click(Sender: TObject);
var
form1 : TForm1;
begin
form1 := TForm1.Create(SELF.Owner);
form1.showmodal;
form1.Destroy;
end;
initialization
TActiveFormFactory.Create(
ComServer,
TActiveFormControl,
TACTF1,
Class_ACTF1,
1,
'',
OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
tmApartment);
end.
-------------------------------------------
-- 자식폼 ---------------------------------
unit Download2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ShellCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ShellTreeView1: TShellTreeView;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ShellTreeView1Change(Sender: TObject; Node: TTreeNode);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Download;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
shelltreeview1.Path := 'c:\downloads';
label3.Caption := shelltreeview1.Path;
end;
procedure TForm1.ShellTreeView1Change(Sender: TObject; Node: TTreeNode);
var
len : integer;
Path : String;
begin
len := strlen(PChar(label3.Caption));
if len > 40 then
begin
end;
Path := shelltreeview1.Path;
label3.Caption := Path;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
test : String;
begin
test := 'testsasdfasdfasd';
close;
end;
end.
------------------------------------------------------
TACTF1.Button1Click에서 TForm1.Create 할때 Owner 를 TACTF1을 주세요
form1 := TForm1.Create(Self);
자식폼에서는 Owner를 참조하시면 될겁니다...
TACTF1(Owner).Label15.Caption := Label3.Caption;
^^ 항상 즐코하세요...