APLX Help : System Classes : List of Classes : Form
|
|
![]() |
Form |
Alternative name: WindowDescriptionThe Form (or Window) object is a standard window, on which can be placed other objects (such as buttons, pictures, or edit text fields). You can determine whether or not it is resizable, has close and zoom boxes, and the appearance of the title bar, by setting the border property when you create the window. The basic border styles are: 0 No border 1 Standard document window, window not resizable 2 Resizable document window 3 Modal-dialog style window 4 Movable modal-dialog style window 5 Thin title-bar, non-resizable window 6 Thin title-bar, resizable window The optional flags which you can add to these basic values are: 16 Window includes a Close box 64 Window includes a Zoom box (under MacOS) or Minimize/Maximize controls (under Windows or Linux) You cannot include a Close box if the basic border type is 0, and you cannot include a Zoom box if it is 0, 5 or 6. Note that, under Linux, the Window Manager determines how the request for a particular border will be interpreted, so the border style you ask for may not be honored. Under some Window Managers, windows are always resizable. The default value is Window propertiesThe other main properties of a Window which you are likely to use are: title: The title which appears in the Window's title bar. visible: Allows you to make the window visible or invisible scale: Determines the units used to place controls in the window (inherits from the System object scale when the window is created). size: The height and width of the window, in the window's own scale. where: The position and size of the window, in the scale of the System object. maxsize: Allows you to specify the maximum size of the window minsize: Allows you to specify the minimum size of the window bitmap: Read-only property which returns a matrix of the pixels which make up the displayed window's contents. (Not implemented under Linux. Under MacOS 9, valid only if the window is completely visible on screen.) Window methodsMethods which are useful include: Open: Open a window which you have previously closed Close: Close a window, either conditionally or unconditionally Wait: Makes the window modal (see below) Draw: Draws geometric shapes and text on the window Window eventsThe event handler (callback) properties which are particularly relevant to Window objects are: onResize: Invoked when the user changes the window's size onFocus: Invoked when the window gets focus (is activated) onClose: Invoked when the user wants to close the window onDestroy: Invoked when the window is destroyed Creating and Opening of WindowsIn order to avoid lots of drawing and moving while creating a window and its child objects, it is always initially created in a hidden state. It is shown (unless explicitly hidden) on the first of the following:
Using windows as modal dialogsThe Wait method makes the window display in modal form, i.e. other windows of your application are disabled until the window has closed. For modal dialogs, you should consider using the Dialog object, which is a special case of the Form object in which the borders and background automatically take on the appropriate appearance for a modal dialog on the system on which APLX is running. Deleting windowsIn order to free up memory used by an object, you must ensure it is deleted when you have finished with it. If you created it using If you created the window using As a convenience, windows which have no onClose callback defined are automatically deleted if the user closes the window. If you still have a reference to the window in the workspace because you created it using Example∇DEMO_Form;DEMO [1] ⍝ Sample function demonstrating use of the Form object [2] ⍝ Set border to 5 (for thin title) plus 16 (Close box) [3] DEMO←'⎕' ⎕NEW 'Form' ⋄ DEMO.border←(5+16) [4] DEMO.title←'Form Example' [5] DEMO.where←4 4 [6] ⍝ [7] ⍝ Wait for the user to close the window [8] 0 0⍴⎕WE DEMO ∇ Propertiesalign anchors aquaadjust autodraw bitmap border caption children class color data doublebuffered dragsource droptarget enabled events extent handle maxsize menuimagelist methods minsize name opened pointer properties scale self size sourceformats targetformats tie units visible where winptr MethodsClick Clienttoscreen Close Create Delete Draw Focus Hide New Open Paint Resize Screentoclient Send Set Show Trigger Wait CallbacksonClick onClose onDblClick onDestroy onDragDrop onDragEnd onDragEnter onDragLeave onDragOver onDragStart onFocus onHide onMenu onMouseDown onMouseMove onMouseUp onMove onOpen onPaint onResize onSend onShow onUnFocus |
|
APLX Help : System Classes : List of Classes : Form
|
Copyright © 1996-2010 MicroAPL Ltd