![]() I have no idea how to add components to a programmatically-created form (not at run-time, but to the source code). procedure TLibraryForm.btnShowStudentIfoFormClick(Sender: TObject) ![]() The only thing you can do is click the close button at the upper-right corner of the window to close it. It does show the form but there's nothing on it. I also have a button on my main form (that's just a regular form that's supposed to create and show the form above at run-time) and when clicked it creates and shows the student form as a modal window. Here's my form class stub: unit clsTStudentInfoForm Add the line regarding position property below (or set it in Form2 designer).I'm working with Delphi 7 and I'm trying to create a form programmatically. However since the form is given a parent that doesn't apply either and the form is just placed at position 0,0. That is because the default value of the TForm.Position property is poDefaultPosOnly which means that the form bypasses the Top and Left settings and leaves it to the OS to decide on the location. The Top and Left properties don't look as expected. With the following code Form2 is shown embedded in the Panel1 of Form1 (I removed the width and height settings to keep the image smaller): procedure TForm1.FormCreate(Sender: TObject) WRONG! So, please take the lesson and pay attention to post actual code and inform about any error messages.Īlso, if your question is about appearance of a form, post the. This error leads to a stack overflow because you are setting Form1 parent to Panel1 which is a child of Form1, iow a chicken - egg dilemma.īecause you did not mention either of these errors, one can only conclude that your code is different from what you have posted, or, you think that error messages are not important. end pair around the properties you want to set after with Form2 do. ![]() In your second edition, where you corrected erroneous references of Form1 to Form2 your code is still missing a begin. After some time the program fails with an out of resources error. In the first edition of your question, your code recreated Form1 within the constructor of the same form. The form is not displayed at startup and Form2 is not embedded in Form1.įor future reference, when you post a question about code, copy - paste actual code and inform possible shown errors. Procedure TForm2.btnCalcClick(Sender: TObject) ![]() Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls Procedure TForm1.FormCreate(Sender: TObject) Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, child Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, I have already tried this tutorial on this page. On this panel we want to embed a second form "Form2".īut not only the components should be embedded, but also the functionality. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |