Here is my sample procdure on how to create form during runtime. Make sure the subject Tfroms are not included in auto-create. I hope it would be usefull.
/// Lets assume you have a newly created form ///
/// The subject form is Tfrm1 ///
/// Declaration ///
private
{ Private declarations }
public
{ Public declarations }
class procedure createAForm(AOwner:TComponent);
end;
{var
frmResponse: TfrmResponse;}
implementation
{$R *.dfm}
class procedure Tfrm1.createAForm(AOwner:TComponent);
var
frm:Tfrm1;
begin
frm:=Tfrm1.Create(AOwner);
with frm do begin
try
/// Optional codes before create displaying the form ///
ShowModal;
finally
Free;
end;
end;
end;
/// Now lets create the subject FORM from the main form ///
///Make sure to include the Subject Form (Tfrm1) on the uses or press ALT+F11 then click the unit///
procedure TfrmMain.button1Click(Sender: TObject);
begin
Tfrm1.createAForm(self);
end;
Delphi Coding Cafe
Your basic source on Delphi Programming.
Google Search
Custom Search
Tuesday, July 6, 2010
Monday, July 5, 2010
Hiding Form Title Bar
Here are some example i know on how to hide your Title Bar, Hope this helps.
//// Declaration ////
protected
procedure CreateParams(var Params: TCreateParams); override;
private
{ Private declarations }
.......
.......
//// Codes ////
procedure Tform1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style and not WS_CAPTION or WS_POPUP;
end;
//// Declaration ////
protected
procedure CreateParams(var Params: TCreateParams); override;
private
{ Private declarations }
.......
.......
//// Codes ////
procedure Tform1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style and not WS_CAPTION or WS_POPUP;
end;
Subscribe to:
Comments (Atom)