Developer Resources
Form
Overview
Represents a form on which controls can be placed.
Base Class
Constructor
- Form(caption : String, x_pos : Integer, y_pos : Integer, width : Integer, height : Integer)
Arguments
- caption
- The caption of the form.
- x_pos
- The x position of the form.
- y_pos
- The y position of the form.
- width
- The width of the form.
- height
- The height of the form.
Methods
- Form.add
- Adds a form control to the form.
- Form.center
- Centers a form relative to its parent.
- Form.close
- Closes the form.
- Form.endDialog
- Displays the form as a modal dialog.
- Form.getCaption
- Gets the form's caption.
- Form.getInnerNativeHandle
- Gets the native handle of the content area of a form
- Form.layout
- Updates the position and size of the form's controls using the form's layout object.
- Form.setCaption
- Sets the caption for the form.
- Form.setLayout
- Sets the layout object to use to position and size the form's controls.
- Form.setMenuBar
- Sets the MenuBar object to use for the form.
- Form.setStatusBar
- Sets the StatusBar object to use for the form.
- Form.setToolBar
- Sets the ToolBar object to use for the form.
- Form.show
- Shows or hides the form.
- Form.showDialog
- Displays the form as a modal dialog.
Inherited Methods
- FormControl.captureMouse
- Captures the mouse on this form control.
- FormControl.disablePaint
- Disables the window from redrawing itself.
- FormControl.enablePaint
- Enables the window to redraw itself.
- FormControl.getBackgroundColor
- Gets the background color of the form control.
- FormControl.getClientSize
- Gets the client size of the form control.
- FormControl.getEnabled
- Indicates whether or not a form control is enabled.
- FormControl.getFont
- Gets the default font for the text of form control.
- FormControl.getForegroundColor
- Gets the foreground color of the form control.
- FormControl.getMaxSize
- Gets the maximum size of the form control.
- FormControl.getMinSize
- Gets the minimum size of the form control.
- FormControl.getMousePosition
- Gets the mouse position relative to this form control.
- FormControl.getNativeHandle
- Gets the native handle of the window/control
- FormControl.getPosition
- Gets the position of a form control.
- FormControl.getSize
- Gets the size of the form control.
- FormControl.invalidate
- Invalidates a form control, which will cause it to be repainted on the next paint event.
- FormControl.refresh
- Refreshes a form control, which immediately repaints the entire form control.
- FormControl.releaseMouse
- Releases the mouse from being captured on this form control.
- FormControl.setBackgroundColor
- Sets the background color of the form control.
- FormControl.setClientSize
- Sets the client size of a form control.
- FormControl.setEnabled
- Enables or disables the form control.
- FormControl.setFocus
- Sets the focus to the form control.
- FormControl.setFont
- Sets the default font for the text of the form control.
- FormControl.setForegroundColor
- Sets the foreground color of the form control.
- FormControl.setMaxSize
- Sets the maximum size of a form control.
- FormControl.setMinSize
- Sets the minimum size of a form control.
- FormControl.setPosition
- Sets the position of a form control relative to the the form control's parent.
- FormControl.setSize
- Sets the size of a form control.
- FormControl.show
- Shows or hides the form control.
- FormControl.update
- Updates a form control, which will immediately repaint any invalid areas.
Example
// create our own class derived from form class MyForm extends Form { function MyForm() { super("Hello World", 100, 100, 200, 100); var b = new Button("Exit", 60, 20, 80, 24); this.add(b); b.click.connect(this, onButtonClicked); } function onButtonClicked() { Application.exit(); } } // create an instance of our derived MyForm class // and show it var f = new MyForm; f.show(); // start the event loop; the application will exit as // soon as the button is clicked Application.run(); alert("Application exiting...");
Form.add
- function Form.add(control : FormControl)
Arguments
- control
- The form control to add to the form.
Description
Adds a form control to the form.
Form.center
- function Form.center()
Description
Centers a form relative to its parent.
Form.close
- function Form.close()
Description
Closes the form.
Form.endDialog
- function Form.endDialog(return_code : Integer) : Boolean
Returns
True if the call was successful, false otherwise.
Description
Calling endDialog() ends a modal dialog. The value passed in the return_code parameter is returned by showDialog().
Form.getCaption
- function Form.getCaption() : String
Returns
Returns the form's caption.
Description
Returns the form's caption.
Form.getInnerNativeHandle
- function Form.getInnerNativeHandle() : Number
Returns
Returns the handle as an numeric value
Description
Returns the native handle of the content area of a form. On Windows, this is the value of the content area's HWND handle.
Form.layout
- function Form.layout()
Description
Updates the position and size of the form's controls using the form's layout object, if it is specified. If no layout object is specified, the function does nothing.
Form.setCaption
- function Form.setCaption(text : String)
Arguments
- text
- The text to which to set the form's caption.
Description
Sets the form's caption to text.
Form.setLayout
- function Form.setLayout(object : Layout)
Arguments
- object
- The layout object to use to position and size the form's controls.
Description
Sets the layout object to use to position and size the form's controls.
Form.setMenuBar
- function Form.setMenuBar(object : MenuBar)
Arguments
- object
- The MenuBar object to use for the form's menu bar.
Description
Sets the MenuBar object to use for the form's menu bar.
Form.setStatusBar
- function Form.setStatusBar(object : StatusBar)
Arguments
- object
- The StatusBar object to use for the form's status bar.
Description
Sets the StatusBar object to use for the form's status bar.
Form.setToolBar
- function Form.setToolBar(object : ToolBar)
Arguments
- object
- The ToolBar object to use for the form's toolbar.
Description
Sets the ToolBar object to use for the form's toolbar.
Form.show
- function Form.show(flag : Boolean)
Arguments
- flag
- A flag which indicates whether to show or hide the form.
Description
Shows the form if the flag is true. Hides the form if the flag is false. If flag isn't specified, the form is shown.
Form.showDialog
- function Form.showDialog() : Integer
Returns
The integer value passed to endDialog()
Description
Calling showDialog() displays the form as a modal dialog. Modal in this sense means that all mouse and keyboard input to all background windows will be disabled until the user is finished with the modal dialog form. The dialog's modality can be ended by calling endDialog(return_code). Standard return codes are DialogResult.OK and DialogResult.Cancel. Once endDialog() is called by the program, the showDialog() will return the value passed as a parameter to endDialog().