Creating Dynamic Forms Using ATEasy

Knowledge Base Article # Q200088

Read Prior Article Read Next Article
Summary How to create form with dynamic content (controls, menu and toolbars) using ATEasy
Login to rate article
ATEasy supports creating dynamic forms. Usually the form contents: Controls and menus is created at design time using the ATEasy form editor. Dynamic forms are forms that their content is created at run time. While it possible to create the form with all the possible controls that you expecting to use at design time and then use the control Visible property to show or hide control and Move method to position them, sometimes you may want to create the controls at run-time based on the form logic.

To create a dynamic form you create a form at design time with the fixed controls on it. At run time you call the InsertControl, AForm class method to create and add additional controls:

btnClicked=InsertControl("btnClicked", "AButton", Form.Width/2-80, Form.Height/2-14, 160, 28)

Once the control is created you can link the control events with an event handler procedure (btnClicked.OnClick) using the AddHandler statement as shown here:

AddHandler btnClicked.OnClick, btnClickedOnClick

Call the RemoveHandler statement and the RemoveControl  method to and release the handler and  delete the control.

For more information on dynamic forms see the Dynamic Form task in the Forms.prg example.
Article Date 12/14/2007
Keywords ATEasy, Form, InsertControl, RemoveControl, AddHandle

Login to rate article

Read Prior Article Read Next Article