Recent

Author Topic: [KOL-CE] Form2, Form3 autocreation ? TKolForm.KeyPreview ?  (Read 4620 times)

Nibbler

  • New member
  • *
  • Posts: 11
[KOL-CE] Form2, Form3 autocreation ? TKolForm.KeyPreview ?
« on: April 24, 2009, 05:17:31 pm »
Hi,

I would like to have several forms in my app.
For now the only way that I found to display a another form is creating it at runtime :

Code: [Select]
procedure TForm1.Button1Click(Sender : PObj);
var Form2 : PForm2;
begin
  NewForm2(Form2,Applet);
  Form2.Form.ShowModal;
  Form2.Form.Free;
end;

But this has two drawbacks :

1°) As the form is dynamically created and freed at each new call, it can't keep saved the states of the various controls inside.
So I must save all the controls states when closing the form and restore the values each time I display it again.
This is quite clumsy if there are several forms with lots of controls inside !

2°) Also, I'm using tman task manager to really close my app when I click the [X] button instead of minimizing it. But tman can't close/hide a form if the button is [ok] instead of [X]. So as Form2.Form.ShowModal displays an [ok] button, tman can't close the forms dynamically created by the above procedure so I can't return to Form1 once that Form2 is displayed  :'(

- So is there a way to autocreate forms with KOL-CE and then keep them alive (just hide/show them) until I close the main form ? 

- Also is it possible to enable KeyPreview in TKolForm ?

When trying to enable it I get a compiler fatal error :

Code: [Select]
main_1.inc(21,17) Error: identifier idents no member "KeyPreview"

Thank you :)