Thema: Delphi Second Form and Thread

Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#1

Second Form and Thread

  Alt 4. Mai 2008, 22:48
Hi , in my application i use a Second Form which is created on RunTime
Delphi-Quellcode:
var
MyNewForm:TSecondForm { this is the Second Form }
.
.
On the Main Form Creat Event
begin
if Not Assigned(MyNewForm) then
MyNewForm:=TSecondForm.create(Nil);
end;

// and release it on main Form Destroy event

MyNewForm.release;
in this Second Form i have 3 Buttons and 2 Labels

Delphi-Quellcode:
on main form button1 click event
MyNewForm.ShowModal;
when i launch this Second Form for the First Time every thing goes well , but when i launch it for the Second time it Freezes the Form is Shown but all other Controls are Hidden ( 3 BUTTONS + 2 LABELS ).
i thought it's because the Form is not safe Threaded.
but how could i thread it , the Values of the 2 labels are from the Main Form
Delphi-Quellcode:
.
.
MyNewForm.label1.caption:={mainform.}label1.caption;
MyNewForm.label2.caption:={mainform.}label2.caption;
.
.
so how could i thread my SecondForm so that whenever i launch it it will not freeze and all their controls are still Visible .


Regards.
  Mit Zitat antworten Zitat