Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Для новичков > Second Form and Thread


Автор: moncef 5.5.2008, 04:45
Hi , in my application i use a Second Form which is created on RunTime 

Код

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 

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 

Код



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. 

Автор: ama_kid 5.5.2008, 07:22
Цитата(moncef @  5.5.2008,  04:45 Найти цитируемый пост)
i thought it's because the Form is not safe Threaded.
I think Form isn't guilty smile and there is another reason present...
It's not clear enough about code below:
Код
MyNewForm.label1.caption:={mainform.}label1.caption; 
MyNewForm.label2.caption:={mainform.}label2.caption;
Where is it placed? 
I've tried to remake situation on my own - and I couldn't get your problem, my forms didn't freeze and controls didn't disappear whenever I called the form2. Can you attach the project with problem described?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)