DEFINE A PANEL WINDOW

 

Creates a PANEL Window Definition

 

 

Description:

 

A Window definition creates a Windows Graphics User Interface (GUI) Window object. This is a system of interactive visual components used by computer programs to display information and allow interaction with users of the computer program

 

A PANEL Window is defined in an HMG program as being within another Window. In effect, it is a Window within a Window. Like all other Windows, it also contains visual functionality and processing that can be completely seperate from any other Window, even it's "host" Window, but it can also interact with any other Windows that have been defined

 

The image below demonstrates a MAIN Window which is acting as a host for two PANEL Windows defined seperately from one another

 

PANEL Windows

 

Syntax:

 

DEFINE WINDOW            <cParentWindowName>

 

    [ ... Other Parent Window Properties (eg. ROW, COL etc) ... ]

 

    WINDOWTYPE           MAIN | STANDARD | CHILD

 

    [ ... Other Parent Window Properties (eg. ONINIT etc) ... ]

 

    DEFINE WINDOW        <cPanelWindowName>

        [ ROW            <nRow> ]

        [ COL            <nCol> ]

        [ WIDTH          <nWidth> ]

        [ HEIGHT         <nHeight> ]

        [ VIRTUALWIDTH   <nVirtualWidth> ]

        [ VIRTUALHEIGHT  <nVirtualHeight> ]

 

        WINDOWTYPE       PANEL

 

        [ FONTNAME       <cFontName> ]

        [ FONTSIZE       <nFontSize> ]

        [ BACKCOLOR      <anBackColour> ]

        [ CURSOR         <cCursorName> ]

        [ ONINIT         <ProcName | bBlock> ]

        [ ONRELEASE      <ProcName | bBlock> ]

        [ ONMOUSECLICK   <ProcName | bBlock> ]

        [ ONMOUSEDRAG    <ProcName | bBlock> ]

        [ ONMOUSEMOVE    <ProcName | bBlock> ]

        [ ONPAINT        <ProcName | bBlock> ]

        [ ONSCROLLUP     <ProcName | bBlock> ]

        [ ONSCROLLDOWN   <ProcName | bBlock> ]

        [ ONSCROLLLEFT   <ProcName | bBlock> ]

        [ ONSCROLLRIGHT  <ProcName | bBlock> ]

        [ ONHSCROLLBOX   <ProcName | bBlock> ]

        [ ONVSCROLLBOX   <ProcName | bBlock> ]

 

        [ ... Other PANEL Window Control Definitions (eg. LABEL) ... ]

 

    END WINDOW    // PANEL Window!

 

    [ ... Other PANEL Window Definitions (If Required) ... ]

 

    [ ... Other PARENT Window Control Definitions (eg. LABEL) ... ]

 

END WINDOW    // PARENT Window!

 

Notes:

  1. The order in which properties are declared before and after the WINDOWTYPE PANEL declaration is important. If any of the properties available for this type of Window are used, they should be declared before or after declaring WINDOWTYPE PANEL as per the order shown in the Syntax section above or the program may fail to compile (build)

  2. It is useful to note that a number of properties can still be defined for a PANEL Window such as ONINTERACTIVERELEASE, ISMAXIMIZED and AUTORELEASE. However, a PANEL Window "inherits" or has its' own properties overriden by the host Window. Furthermore, some Properties, Methods or Commands may be accepted and compile that later cause the program to crash with a fatal error. For example, if you attempt to RELEASE a PANEL Window! Therefore, this document only covers those properties that are specifically linked too and can be used directly on a PANEL Window

  3. ROW, COL, WIDTH and HEIGHT. If any of these properties is not specified during the Window defnition a default value is used;

    • ROW and/or COL - Both default to a value of 0 within the client work area of the host Window

    • WIDTH and/or HEIGHT - These will be set to the maximum width and/or height of the client work area of the host Window

  4. If you intend to use a TOOLBAR, do not create a PANEL Window that is virtually dimensioned with VIRTUALWIDTH or VIRTUALHEIGHT. The program will compile and appear to run until you attempt to use the virtual dimension controls at which point it will crash with a fatal error

  5. VIRTUALWIDTH and VIRTUALHEIGHT. The values for these properties must be greater than the values set for their respective WIDTH and HEIGHT properties

  6. The AUTORELEASE Property for a PANEL Window is ignored if used as it inherits the value of the property set for the host Window

  7. If an ONINIT Event Property is declared for both the host and the PANEL Window, the ONINIT procedure or code block for the PANEL Window will be evaluated first followed by the procedure or code block for the host Window

  8. If an ONRELEASE Event Property is declared for both the host and the PANEL Window, the ONRELEASE procedure or code block for the host Window will be evaluated first followed by the procedure or code block for the PANEL Window. Additionally, if an ONINTERACTIVERELEASE Event Property is declared for the host Window, then the procedure or code block for the host Window will be evaluated before either of the ONRELEASE Event Properties

  9. ACTIVATE WINDOW ALL. If this command is used at program start-up, then all windows apart from MAIN will automatically have AUTORELEASE set to true (.T.)

  10. VSCROLLBAR and HSCROLLBAR. These are pre-defined controls that are "built in" when a virtually dimensioned Window is declared that includes the capability to scroll vertically and/or horizontally

  11. The original version of the help file for this item can be viewed here

Window Properties:

 

The following Window Properties are available to use when defining the PANEL Window

 

Name Data Type Control Description
ROW Numeric D, R, W Sets the row number on the screen to place the top edge of Window
COL Numeric D, R, W Sets the column number on the screen to place the left edge of Window
WIDTH Numeric D, R, W Sets the width of the Window
HEIGHT Numeric D, R, W Sets the height of the Window
VIRTUALWIDTH Numeric D Sets the virtual width of the Window
VIRTUALHEIGHT Numeric D Sets the virtual height of the Window
WINDOWTYPE N/A D Defines which style of Window to create
FONTNAME Character D Sets the default font to use on any Window elements and any controls that don't have their own specific FONTNAME defined
FONTSIZE Numeric D Sets the default font size to use on any Window elements and any controls that don't have their own specific FONTSIZE defined
BACKCOLOR Character D Sets the background colour to display in the client work area of the Window
CURSOR Character D Specifies the file name of the mouse cursor to use with the Window

 

Each of the following Window Properties are available after the PANEL Window has been defined

 

Name Data Type Control Description
FOCUSEDCONTROL Character R Gets the name of the control that is currently in focus within a Window
NAME Character R Returns the name defined for the Window
HANDLE Numeric R Returns the operating system Window handle number
INDEX Numeric R Returns the program's Window index number. Please refer to notes in the associated Help documentation
CLIENTAREAHEIGHT Numeric R Returns a numeric value indicating of height of the work area within the Window
CLIENTAREAWIDTH Numeric R Returns a numeric value indicating of width of the work area within the Window
ENABLED Logical R, W Enables and disables the Window
HSCROLL Logical R, W Enables and disables the Horizontal Scroll Bar Control on a virtually dimensioned Window
VSCROLL Logical R, W Enables and disables the Vertical Scroll Bar Control on a virtually dimensioned Window
ALPHABLENDTRANSPARENT Numeric W Sets the level of transparency of a Window
BACKCOLORTRANSPARENT Array W Sets the Window's background transparency colour

 

D - Properties of this type can be used when defining a Window

R - Properties of this type can only be accessed (read) after the Window has been defined

W - Properties of this type can be changed (write) after the Window has been defined

 

See GETPROPERTY and SETPROPERTY functions for further infomation on accessing or changing properties or use semi-OOP syntax

 

Windows Event Properties:

 

Each of the following Windows Event Properties are available to use when defining the PANEL Window. When used, they contain the name of a procedure to run or a code block to evaluate if that event occurs;

 

Event Description
ONINIT Runs once when the Window is initialised by the ACTIVATE WINDOW <FormName> command
ONRELEASE Runs once before the Window is released from memory when the Window is closed by the RELEASE method or when it is closed by any other means
ONMOUSECLICK Runs whenever the left mouse button is clicked in any free space in the client work area (ie. not when over a Control)
ONMOUSEDRAG Runs for every movement of the mouse pointer when the left mouse button is clicked, held and dragged in any free space in the client work area (ie. not when over a Control)
ONMOUSEMOVE Runs for every movement of the mouse pointer within any free space in the client work area (ie. not when over a Control). This includes when the Window is not actually in focus
ONPAINT Should execute when the Window is painted. Testing shows erratic and unpredictable behaviour! Activates on EVERY paint (label, text ANYTHING)
ONSCROLLUP Runs once for every click on the vertical scroll up arrow
ONSCROLLDOWN Runs once for every click on the vertical scroll down arrow
ONSCROLLLEFT Runs once for every click on the horizontal scroll left arrow
ONSCROLLRIGHT Runs once for every click on the horizontal scroll right arrow
ONHSCROLLBOX Runs once for each click within horizontal scroll box or once after dragging and releasing the horizontal scroll box. Menu appears when right mouse button clicked.
ONVSCROLLBOX Runs once for each click within vertical scroll box or once after dragging and releasing the vertial scroll box. Menu appears when right mouse button clicked.

 

Windows Methods:

 

Each of the following Methods can be used to perform an action that accesses, changes or modifies the Window;

 

Method Description
CAPTURE Captures a screenshot of the Window as a bitmap file (.BMP) which can be saved
PRINT Prints a screenshot of the Window
SHOW Makes the Window visible on screen after activation
HIDE Hides the Window from the screen after activation
CENTER Centers the Window on the desktop screen
MAXIMIZE Maximises the Window to take up the entire desktop screen. Whilst this Method will work on a PANEL Window, its' behaviour may to unpredictable!
MINIMIZE Minimises the Window from the desktop screen to the task bar. Whilst this Method will work on a PANEL Window, its' behaviour may to unpredictable!
RESTORE Restores a Window to its previous size and position when it has been maximized or minimized. Whilst this Method will work on a PANEL Window, its' behaviour may to unpredictable!
SETFOCUS Sets focus onto the Window
REDRAW Redraws the Window?
CENTERWORKAREA Centers the Window on the desktop screen. WinName.CENTERWORKAREA does not compile!
CENTERIN(<FormName2>) Centers the Window over another Window's position on the desktop screen. Whilst this Method will work on a PANEL Window, its' behaviour may to unpredictable!

 

Windows Commands:

 

Each of the following Window Commands can be used to perform an action with or on the Window;

 

Command Description
CENTER WINDOW <FormName> [ DESKTOP ] Centers a Window when it is displayed (shown) on screen
CENTER WINDOW <FormName1> IN <FormName2> Centers a Window over another Window when it is displayed (shown) on screen
SET WINDOW <FormName> TRANSPARENT ... Sets the level of a Window's transparency when it is displayed on screen

 

Sample Code:

 

Sample code to view the definition of two seperate PANEL Windows hosted by a MAIN Window can be found here