Creating objects during runtime
Greetings everyone:
I've been having problem creating object during runtime, but I'm having
quite a bit of problem here. What I'm trying to do is to create an object
WITHIN a TTabSheet of a TPageControl. I want to create a TMemo, a TEdit,
and a TButton, but for some reason it never works for me. Does anyone know
the secret to this? If you do, can you please teach me? Thanks!
Thomas
Here is my code so far, and it won't work... =(
I could only create the TabSheet, I can never see the Memo, and same for
TEdit and TButton
with TTabSheet.Create(Chat_Channel) do
begin
PageControl := Chat_Channel;
Name := Target;
Caption := Target;
showmessage(inttostr(Chat_Channel.PageCount-1));
end;
// from HERE I'm Lost
with Chat_Channel.Pages[Chat_Channel.PageCount-1]
do begin
with TButton.Create(Private_Dialog)
do begin
PageControl := Chat_Channel;
Name := 'adf';
Width := 1000;
Height := 1000;
Left := 0;
Top := 0;
Visible := True;
end;
with TButton.Create(Private_Send)
do begin
Width := 1000;
Height := 1000;
Caption := 'WHY THE F WONT THIS WORK??';
Top := 0;
Left := 0;
Visible := True;
// dolog('button left: ' + inttostr(left) + ' top: ' +
inttostr(top));
// dolog('button height: ' + inttostr(height) + '
width: ' + inttostr(width));
end;
with TEdit.Create(Private_Edit)
do begin
Width := 1024;
Text := 'Uh huh...';
Top := 20;
Left := 20;
Visible := True;
end;
end;