Form
A fully customisable dialog. The form can be used as the base component for facilitating feedback from interactive scripts.
Example
-- Create a 'Form' and a 'Label' to put on it form = cf.Form.New("My Custom Dialog") label = cf.FormLabel.New("Hello world!") -- Add the label to the form's layout form:Add(label) -- Execute the form, potentially waiting for user input from buttons and widgets added -- to the form form:Run()
Usage locations
The Form object can be accessed from the following locations:
Property List
- Buttons
- A grouping that contains the OK and Cancel buttons. (Read only FormButtons)
- Height
- The height in pixels of the form window. (Read only number)
- Title
- The title that will be displayed in the title bar at the top of the form. (Read/Write string)
- Type
- The object type string. (Read only string)
- Width
- The width in pixels of the form window. (Read only number)
Collection List
- FormItems
- The collection of item widgets contained in the form. (FormItemCollection of FormItem.)
Method List
- Accept ()
- Close the dialog and return true as return code for the Run() method.
- Add (item FormItem)
- Adds the given item to the form. Items can be any of the defined form item types.
- Add (item FormItem, row number, column number)
- Adds the given item to the form at the specified position. Positions are defined as a row and column, starting at (1,1).
- Reject ()
- Close the dialog and return false as return code for the Run() method.
- Remove (item FormItem)
- Removes the given item from the form. The item can be any of the items that resides in the collection of the form items.
- Resize ()
- Resize form to fit visible contents.
- Run ()
- Executes the form. The values of any items will be modified and made accessible in a script once the OK button on the form is pressed. (Returns a boolean object.)
- SetSize (width number, height number)
- Set the width and height of the form in pixels. Ensure that width and height are larger than zero.
Constructor Function List
- Critical (title string, message string)
- Creates a new critical message form and displays it. Further execution of the script is halted.
- Info (title string, message string)
- Creates an information message form and displays it.
- New (title string, layout FormLayoutEnum)
- Creates a new form with a specified label and layout. (Returns a Form object.)
- New (title string)
- Creates a new form with a specified label and vertical layout. (Returns a Form object.)
- New ()
- Creates a new form with a vertical layout. (Returns a Form object.)
- Warning (title string, message string)
- Creates a new warning message form and displays it.
Property Details
- Buttons
- A grouping that contains the OK and Cancel buttons.
- Type
- FormButtons
- Access
- Read only
- Height
- The height in pixels of the form window.
- Type
- number
- Access
- Read only
- Title
- The title that will be displayed in the title bar at the top of the form.
- Type
- string
- Access
- Read/Write
- Type
- The object type string.
- Type
- string
- Access
- Read only
- Width
- The width in pixels of the form window.
- Type
- number
- Access
- Read only
Collection Details
- FormItems
- The collection of item widgets contained in the form.
Method Details
- Accept ()
- Close the dialog and return true as return code for the Run() method.
- Add (item FormItem)
- Adds the given item to the form. Items can be any of the defined form item types.
- Input Parameters
- item(FormItem)
- The form item to add to the form.
- Add (item FormItem, row number, column number)
- Adds the given item to the form at the specified position. Positions are defined as a row and column, starting at (1,1).
- Reject ()
- Close the dialog and return false as return code for the Run() method.
- Remove (item FormItem)
- Removes the given item from the form. The item can be any of the items that resides in the collection of the form items.
- Input Parameters
- item(FormItem)
- The form item to remove from the form.
- Resize ()
- Resize form to fit visible contents.
- Run ()
- Executes the form. The values of any items will be modified and made accessible in a script once the OK button on the form is pressed.
- Return
- boolean
- True for the OK button and false for the Cancel button.
- SetSize (width number, height number)
- Set the width and height of the form in pixels. Ensure that width and height are larger than zero.
Static Function Details
- Critical (title string, message string)
- Creates a new critical message form and displays it. Further execution of the script is halted.
- Info (title string, message string)
- Creates an information message form and displays it.
- New (title string, layout FormLayoutEnum)
- Creates a new form with a specified label and layout.
- Input Parameters
- title(string)
- The form window title.
- layout(FormLayoutEnum)
- A value indicating how new items will be arranged.
- Return
- Form
- The newly created form.
- New (title string)
- Creates a new form with a specified label and vertical layout.
- New ()
- Creates a new form with a vertical layout.
- Return
- Form
- The newly created form.
- Warning (title string, message string)
- Creates a new warning message form and displays it.