Hello,
Today I’m bringing some basic information on user forms that you can use in BETA.
The documentation is not complete. We keep working on it for next commercial release. Thanks.
FORM
To create a form, use the object System that is registered in every script.
The method you need is called CreateForm and has four optional parameters:
Example:
var form = System.CreateForm(‘FormName’, ‘Form Caption’, 200, 150);
1. First Parameter – Name of form (it mustn’t contain spaces and other invalid/not permitted characters).
2. Second Parameter – Caption that will be displayed in the heading of the form.
3. Third Parameter – Width of the form.
4. Fourth Parameter – Height of the form.
Functions of Form
AddControl(ControlName: widestring, ControlType: Integer): IDispatch;
- ControlName – Name under which the control is accessible.
- ControlType – Number of control type that should be created.
See the following:
- 1 - Edit Box
- 2 - Check Box
- 3 - Memo
- 4 - Panel
- 5 - Label
- 6 - Group Box
- 7 - Radio Button
- 8 - Combo Box
- 9 - List Box
- 10 - Button
This function adds control on the form.
ShowModal()
This function displays the form.
Procedures of Form
AddUserVariable(AName: widestring, DefaultValue)
- AName – Name under which a variable is accessible in events of forms.
- DefaultValue – Default value. It can be of types integer, widestring or boolean.
This procedure adds a variable on the form. The variable is then accessible in events via calling the Instance.VariableName. The variable is accessible across events. If you change a content of the variable in one event, the changed status will be accessible in another event.
RegisterObject(AName: widestring, AObject: IDispatch)
- AName – Name of object via which it will be accessible in events.
- Aobject – Object that is registered.
Use this procedure to register objects in events.
Properties of Form
Caption – Heading of the form.
CloseAfterExecute – True – When you click Execute, the code will be executed and the form closed. False – The form will not close after execution. False is set up by default.
ExecuteMethodName – Name of method that should be executed when you press the Execute button.
ExecuteScriptName – Name of script for calling out the method when you click the Execute button.
Note: If you don’t want to use the button Execute, do not set up the properties ExecuteMethodName and ExecuteScriptName. The button will not be visible on the form then.
EVENTS
To assign events, assign the component of particular event to properties of names NameEventScriptName, NameEventMethodName with reference to particular service method.
Example:
Button.OnClickScriptName = ‘MyScript’;
Button.OnClickMethodName = ‘DoOnClick’;
CONTROL
Control is an ancestor from which all controls, including the form, inherit.
Properties of Control
Align – Alignment of control. Possible values to use:
0 No alignment
1 Alignment - Top
2 Alignment - Bottom
3 Alignment - Left
4 Alignment - Right
5 Alignment – Justify
AnchorTop, AnchorBottom, AnchorLeft, AnchorRight – Determines the position of control. Default place – top left-hand corner.
Parent – Control on which a control is placed. Default position of all controls is on the form and this property is not set up.
Note: Description of value Align 0..5:
alNone - The control remains where it was placed. This is the default value.
alTop - The control moves to the top of its parent and resizes to fill the width of its parent. The height of the control is not affected.
alBottom - The control moves to the bottom of its parent and resizes to fill the width of its parent. The height of the control is not affected.
alLeft - The control moves to the left side of its parent and resizes to fill the height of its parent. The width of the control is not affected.
alRight - The control moves to the right side of its parent and resizes to fill the height of its parent. The width of the control is not affected.
alClient - The control resizes to fill the client area of its parent. If another control already occupies part of the client area, the control resizes to fit within the remaining client area.
BUTTON
Event
OnClick – Occurs when you click the button.
CHECKBOX
Event
OnClick – Occurs when the check in checkbox is changed.
COMBO-BOX
Event
OnSelect - Occurs when combo box is selected.
EDIT
Event
OnChangeText – Occurs when text in edit box is changed.
MEMO
Event
OnChangeText – Occurs when text in memo is changed.
RADIO BUTTON
Event
OnClick – Occurs when the button is selected.
More details will be available in Reference Guide. This document will be updated for next commercial release of Toad Data Modeler. For now, please do not hesitate to write us your questions via Modeling community forum. We are looking forward to hearing from you!
Have a nice day.
Regards,
Vladka + TDM Team