DEFINE WINDOW
Creates a Window Definition

 

 

 

Standard Syntax (xBase Style):

 

 

      DEFINE WINDOW <WindowName>

            AT <nRow> ,<nCol>

            WIDTH <nWindth>

            HEIGHT <nHeight>

            [ VIRTUAL WIDTH <nVirtualWindth> ]

            [ VIRTUAL HEIGHT <nVirtualHeight> ]

            [ TITLE <cTitle> ]

            [ ICON <cIconName> ]

            [ MAIN | CHILD | MODAL | SPLITCHILD | PANEL ]

            [ NOSHOW ]

            [ TOPMOST ]

            [ NOAUTORELEASE ]

            [ NOMINIMIZE ]

            [ NOMAXIMIZE ]

            [ NOSIZE ]

            [ NOSYSMENU ]

            [ NOCAPTION ]

            [ CURSOR <CursorName> ]

            [ ON INIT <InitProcedureName> | <bBlock> ]

            [ ON RELEASE <ReleaseProcedureName> | <bBlock> ]

            [ ON INTERACTIVECLOSE <InteractiveCloseProcedureName> | <bBlock> ]

            [ ON MOUSECLICK <MouseClickProcedureName> | <bBlock> ]

            [ ON MOUSEDRAG <MouseDragProcedureName> | <bBlock> ]

            [ ON MOUSEMOVE <MouseMoveProcedureName> | <bBlock> ]

            [ ON SIZE <WindowSizeProcedureName> | <bBlock> ]

            [ ON MAXIMIZE <WindowMaximizeProcedureName>  | <bBlock> ]

            [ ON MINIMIZE <WindowMinimizeProcedureName>  | <bBlock> ]

            [ ON PAINT<WindowPaintProcedureName>  | <bBlock> ]

            [ BACKCOLOR <anBackColor> ]

            [ FONT <cFontName> SIZE <nFontSize> ]

            [ NOTIFYICON <cNotifyIconName> ]

            [ NOTIFYTOOLTIP <cNotifyTooltip> ]

            [ ON NOTIFYCLICK <NotifyClickProcedure> | <bBlock> ]

            [ ON GOTFOCUS <ProcedureName> | <bBlock> ]

            [ ON LOSTFOCUS <ProcedureName> | <bBlock> ]

            [ ON SCROLLUP <ProcedureName> | <bBlock> ]

            [ ON SCROLLDOWN <ProcedureName> | <bBlock> ]

            [ ON SCROLLLEFT <ProcedureName> | <bBlock> ]

            [ ON SCROLLRIGHT <ProcedureName> | <bBlock> ]

            [ ON HSCROLLBOX <ProcedureName> | <bBlock> ]

            [ ON VSCROLLBOX <ProcedureName> | <bBlock> ]

            [ HELPBUTTON ] 

            [ GRIPPERTEXT <cGripperText> ]

            [ BREAK ]

            [ FOCUSED ]

            ... Control Definitions...

 

      END WINDOW

 

 

Alternate Syntax:

 

 

      DEFINE WINDOW <WindowName>

            ROW <nRow>

            COL <nCol>

            WIDTH <nWindth>

            HEIGHT <nHeight>

            WINDOWTYPE MAIN | CHILD | MODAL | SPLITCHILD | STANDARD | PANEL

            [ VIRTUALWIDTH <nVirtualWindth> ]

            [ VIRTUALHEIGHT <nVirtualHeight> ]

            [ TITLE <cTitle> ]

            [ ICON <cIconName> ]

            [ VISIBLE <lValue> ]

            [ TOPMOST [<lValue>] ]

            [ AUTORELEASE <lValue> ]

            [ MINBUTTON <lvalue> ]

            [ MAXBUTTON <lValue> ]

            [ SIZABLE <lValue> ]

            [ SYSMENU <lValue> ]

            [ TITLEBAR <lValue> ]

            [ CURSOR <CursorName> ]

            [ ONINIT <InitProcedureName> | <bBlock> ]

            [ ONRELEASE <ReleaseProcedureName> | <bBlock> ]

            [ ONINTERACTIVECLOSE <InteractiveCloseProcedureName> | <bBlock> ]

            [ ONMOUSECLICK <MouseClickProcedureName> | <bBlock> ]

            [ ONMOUSEDRAG <MouseDragProcedureName> | <bBlock> ]

            [ ONMOUSEMOVE <MouseMoveProcedureName> | <bBlock> ]

            [ ONSIZE <WindowSizeProcedureName> | <bBlock> ]

            [ ONMAXIMIZE <WindowMaximizeProcedureName>  | <bBlock> ]

            [ ONMINIMIZE <WindowMinimizeProcedureName>  | <bBlock> ]

            [ ONPAINT<WindowPaintProcedureName>  | <bBlock> ]

            [ BACKCOLOR <anBackColor> ]

            [ FONTNAME <cFontName> FONTSIZE <nFontSize> ]

            [ NOTIFYICON <cNotifyIconName> ]

            [ NOTIFYTOOLTIP <cNotifyTooltip> ]

            [ ONNOTIFYCLICK <NotifyClickProcedure> | <bBlock> ]

            [ ONGOTFOCUS <ProcedureName> | <bBlock> ]

            [ ONLOSTFOCUS <ProcedureName> | <bBlock> ]

            [ ONSCROLLUP <ProcedureName> | <bBlock> ]

            [ ONSCROLLDOWN <ProcedureName> | <bBlock> ]

            [ ONSCROLLLEFT <ProcedureName> | <bBlock> ]

            [ ONSCROLLRIGHT <ProcedureName> | <bBlock> ]

            [ ONHSCROLLBOX <ProcedureName> | <bBlock> ]

            [ ONVSCROLLBOX <ProcedureName> | <bBlock> ]

            [ HELPBUTTON <lValue> ]

            [ GRIPPERTEXT <cGripperText> ]

            [ BREAK lValue ]

            [ FOCUSED <lValue> ]

 

            ... Control Definitions...

 

      END WINDOW

 

 

Focused, Break and GripperText properties are available only for 'SplitChild' type windows.

Topmost property is not available for modal and spltchild type windows.

 

 

Properties:

 

 

      - Row

      - Col

      - Width

      - Height

      - Title

      - NotifyIcon

      - NotifyTooltip

      - FocusedControl (R)

      - Cursor (W)

      - VirtualWidth (D)

      - VirtualHeight (D)

      - Icon (R)

      - WindowType (D)

      - Visible (D)

      - AutoRelease (D)

      - MinButton (D)

      - MaxButton (D)

      - Sizable (D)

      - SysMenu (D)

      - TitleBar (D)

      - BackColor (D)

      - FontName (D)

      - FontSize (D)

      - HelpButton (D)

      - GripperText (D)

      - Break (D)

      - Focused (D)

      - Topmost (D)

      - Name (R)

 

R: Read-Only (available after control definition via GetProperty function or semi-oop syntax)

W: Write-Only (available after control definition via SetProperty function or semi-oop syntax)

D: Available at definition only

 

Properties not tagged are available for read and write after control definition via SetProperty and GetProperty functions or semi-oop syntax.

 

 

Methods:

 

 

      - Capture

      - Print

      - Show

      - Hide

      - Center

      - Maximize

      - Minimize

      - Activate

      - Restore

      - Release

      - SetFocus

 

 

Window Events:

 

 

-    OnInit

-    OnRelease

-    OnInteractiveClose

-    OnMouseClick

-    OnMouseDrag

-    OnMouseMove

-    OnSize

-    OnMaximize

-    OnMinimize

-    OnPaint

-    OnNotifyClick

-    OnGotFocus

-    OnLostFocus

-    OnScrollUp

-    OnScrollDown

-    OnScrollLeft

-    OnScrollRight

-    OnHscrollBox

-    OnVscrollBox

 

 

New Properties:

 

 

      ThisWindow|<FormName>.Handle            --> nFormHandle

      ThisWindow|<FormName>.Index             --> nFormIndex

      ThisWindow|<FormName>.IsMinimized       --> lBoolean

      ThisWindow|<FormName>.IsMaximized       --> lBoolean

      ThisWindow|<FormName>.ClientAreaWidth   --> nWidth

      ThisWindow|<FormName>.ClientAreaHeight  --> nHeight

 

      ThisWindow|<FormName>.NoCaption   [ := | --> ] lBoolean

      ThisWindow|<FormName>.NoMaximize  [ := | --> ] lBoolean

      ThisWindow|<FormName>.NoMinimize  [ := | --> ] lBoolean

      ThisWindow|<FormName>.NoClose     [ := | --> ] lBoolean

      ThisWindow|<FormName>.NoSize      [ := | --> ] lBoolean

      ThisWindow|<FormName>.NoSysMenu   [ := | --> ] lBoolean

      ThisWindow|<FormName>.HScroll     [ := | --> ] lBoolean

      ThisWindow|<FormName>.VScroll     [ := | --> ] lBoolean

      ThisWindow|<FormName>.Enabled     [ := | --> ] lBoolean

 

      ThisWindow|<FormName>.AlphaBlendTransparent := nAlphaBlend (0 to 255, Completely Transparent = 0, Opaque = 255)

      ThisWindow|<FormName>.BackColorTransparent  := aRGBColor

 

 

 

 

# Visual Effects on Windows

 

 

-    SET WINDOW FormName TRANSPARENT TO COLOR aRGBColor

-    SET WINDOW FormName TRANSPARENT TO nAlphaBlend  --> nAlphaBlend = 0 to 255 (completely transparent = 0, opaque = 255)

-    SET WINDOW FormName [ TRANSPARENT ] TO OPAQUE

 

 

-    FLASH WINDOW FormName CAPTION COUNT nTimes INTERVAL nMilliseconds

-    FLASH WINDOW FormName TASKBAR COUNT nTimes INTERVAL nMilliseconds

-    FLASH WINDOW FormName [ ALL ] COUNT nTimes INTERVAL nMilliseconds

 

 

-    ANIMATE WINDOW FormName INTERVAL nMilliseconds MODE nFlags

-    ANIMATE WINDOW FormName MODE nFlags

 

- MODE <nFlags> (see the function AnimateWindow() in the API Window Reference), constants defined in i_Window.ch

#define AW_HOR_POSITIVE 0x00000001

#define AW_HOR_NEGATIVE 0x00000002

#define AW_VER_POSITIVE 0x00000004

#define AW_VER_NEGATIVE 0x00000008

#define AW_CENTER       0x00000010

#define AW_HIDE         0x00010000

#define AW_ACTIVATE     0x00020000

#define AW_SLIDE        0x00040000

#define AW_BLEND        0x00080000

 

 

 

Tips:

 

 

      - SplitChild windows can be defined as part of a splitbox only.

 

      - Toolbar's & SplitBox's parent window can't be a 'Virtual Dimensioned'

      window (use 'Virtual Dimensioned' splitchild's instead)

 

      - NoAutoRelease Style: When this style is used, windows are hide

      instead released from memory when the user clicks in the close box.

      Using "Activate Window All" command at program startup will force

      "NoAutoRelease" style for all windows (excepting main).

      You must use "Show" and "Hide" methods to make a window visible or

      invisible.

 

-    For virtual dimensioned Windows, two predefined controls are available.

These controls are called ‘vScrollBar’ and ‘hScrollBar’.

‘Value’ property (read only) is available for these controls.

 

Sample:

 

#include "hmg.ch"

Function Main

 

   SET AUTOSCROLL ON

 

   DEFINE WINDOW Form_Main ;

         AT 0,0 ;

         WIDTH 640 ;

         HEIGHT 480 ;

         VIRTUAL WIDTH 1300 ;

         VIRTUAL HEIGHT 800 ;

         TITLE 'Virtual Dimensioned Window Demo' ;

         MAIN

 

         @ 100,10 BUTTON Button_1 ;

               CAPTION 'Vert. ScrollBar Value' ;

               ACTION MsgInfo( Str ( Form_Main.VScrollBar.Value ) ) ;

               WIDTH 150 HEIGHT 25

 

         @ 200,10 BUTTON Button_2 ;

               CAPTION 'Horiz. ScrollBar Value' ;

               ACTION MsgInfo( Str ( Form_Main.HScrollBar.Value ) ) ;

               WIDTH 150 HEIGHT 25

 

   END WINDOW

 

   ACTIVATE WINDOW Form_Main

 

Return Nil