ginsonic
asked on
Runtime creation of my Form
Don't know how many experts use Billenium package - bad boys if not use :), very good library.
Anyway I think that you can help me in any case. Untill now I embedded a form in my container using next code:
Form2 := TForm2(W1.CreateForm(TForm 2));
W1.ShowForm(Form2, True);
All ok, just that now I create my Form2 on runtime.
with TForm.Create(Self) do Name:='Form2';
Form2 := TForm2(W1.CreateForm(TForm 2));
W1.ShowForm(Form2, True);
In this case I get message that Form2 is unknown ( and I know that is true but don't know how to use after runtime creation )
Any help ?
Anyway I think that you can help me in any case. Untill now I embedded a form in my container using next code:
Form2 := TForm2(W1.CreateForm(TForm
W1.ShowForm(Form2, True);
All ok, just that now I create my Form2 on runtime.
with TForm.Create(Self) do Name:='Form2';
Form2 := TForm2(W1.CreateForm(TForm
W1.ShowForm(Form2, True);
In this case I get message that Form2 is unknown ( and I know that is true but don't know how to use after runtime creation )
Any help ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what is W1 ?
ASKER
I try to use Application.CreateForm(TFo rm2, Form2) but the form must be added to project.
I have a script where I get some questions. Depend of the questions number I will create a new form for each 15 questions.
For 48 questions, for example, I will host 4 new forms.
I can't create these forms at design mode because I can't know what type of vcl will use and the number of vcl ( editboxes, comboboxes, own vcl for datetime ... ).
What do the program. The client need to evaluate each case using a quizz ( a questions set ). This set can be changed each month so I wish to make it a little 'visual'. The client make a script that will contain all informations about questions:
Question1.Text
Question1.VCL.Name
Question1.VCL.Type
........
Question1.Record.Name
.....
Using this script I wish to create forms, to populate these with VCL and assign events. A little harder for my experience, but I like the challenge.
For kretzschmar,
W1 is a FormContainer. I create Form2 and embedded into W1 form container.
I have a script where I get some questions. Depend of the questions number I will create a new form for each 15 questions.
For 48 questions, for example, I will host 4 new forms.
I can't create these forms at design mode because I can't know what type of vcl will use and the number of vcl ( editboxes, comboboxes, own vcl for datetime ... ).
What do the program. The client need to evaluate each case using a quizz ( a questions set ). This set can be changed each month so I wish to make it a little 'visual'. The client make a script that will contain all informations about questions:
Question1.Text
Question1.VCL.Name
Question1.VCL.Type
........
Question1.Record.Name
.....
Using this script I wish to create forms, to populate these with VCL and assign events. A little harder for my experience, but I like the challenge.
For kretzschmar,
W1 is a FormContainer. I create Form2 and embedded into W1 form container.
ASKER
BTW, W1 is created at runtime too, but I have an algorithm to find this component by name. Unfortunatelly can't find a new form by name.
var c: TComponent;
...
C := FindComponentEx('Form1.W1' );
var c: TComponent;
...
C := FindComponentEx('Form1.W1'
ASKER
And then ... TFormContainer(C).Visible := True; or something else.
ASKER
I will use a dynamic form array.
ASKER
VAR
FORM1 : TFORM;
BEGIN
FORM1:=TFORM.CREATE(SELF);
because sometimes I create 1-2 forms, someelse more than 20, so I can't add var Form2, Form3 ....Form n