[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    oWin:Activate( cSize, bLClicked, bRClicked, bMoved, bResized, bPainted,;
                   bKeyDown, bInit, bUp, bDown, bPgUp, bPgDn, bLeft, bRight,;
                   bPgLeft, bPgRight, bValid, bDropFiles, bLButtonUp )
-------------------------------------------------------------------------------

    ACTIVATE WINDOW <oWin> ;
           [ VALID <uValid> ] ;
           [ <show: ICONIZED , NORMAL , MAXIMIZED> ] ;
           [ ON [ LEFT ] CLICK <uLClick> ] ;
           [ ON LBUTTONUP <uLButtonUp> ] ;
           [ ON RIGHT CLICK <uRClick> ] ;
           [ ON MOVE <uMove> ] ;
           [ ON RESIZE <uResize> ] ;
           [ ON PAINT <uPaint> ] ;
           [ ON KEYDOWN <uKeyDown> ] ;
           [ ON INIT <uInit> ] ;
           [ ON UP <uUp> ] ;
           [ ON DOWN <uDown> ] ;
           [ ON PAGEUP <uPgUp> ] ;
           [ ON PAGEDOWN <uPgDn> ] ;
           [ ON LEFT <uLeft> ] ;
           [ ON RIGHT <uRight> ] ;
           [ ON PAGELEFT <uPgLeft> ] ;
           [ ON PAGERIGHT <uPgRight> ] ;
           [ ON DROPFILES <uDropFiles> ]



 PARAMETER:


  <oWin>       Is the reference to the Window Object that will be
               activated


  <uValid>     This Action will be performed whenever one attempts to close 
               the Window. <uValid> has to return a logical value to 
               indicate whether or not the window is allowed to be closed,
               like the VALID Clause in a GET

  <Show>       This character string determines the 'visibility status' of
               the window when it is displayed. It is one of this Strings:

                 NORMAL     Show the window with the size defined by
                            ::nTop, ::nLeft, ::nBottom and ::nRight.
                            This is the default Value

                 ICONIZED   The window will be shown iconized on the
                            desktop.

                 MAXIMIZED  Show the window in it largest possible size,
                            which will cover the entire screen.


  <uLClick>    will be performed whenever the left Mousebutton is clicked on 
               the Window. Like the other Clauses, uLClick will be converted 
               into a Codeblock. This Block is then stored inside the iVar 
               blClicked of oWin:

                 oWin:bLClicked := {|nRow, nCol, nKeyFlags| uLClick },

               please press  Related Topics:  and select  WM_BUTTON  for
               detailed informations about the topic and parameters


  <uRClick>    Like uLClick, but performed for the right Mousebutton
               Defined as oWin:bRClicked := {|nRow,nCol,nKeyFlags| uRClick}

  <uLButtonUp> will be performed when the left Mousebutton is released
               over the Window. Defined as 
                 oWin:bLButtonUp := {|nRow,nCol,nKeyFlags|uLButtonUp}

  <uMove>      Action to be performed every time the Window is moved.
               Also only defined as oWnd:bMoved := {||uMove}, it gets 
               2 Parameter passed at evalTime:

                <nRow>   The new row of our Window in Pixels
                <nCol>   The new col of our Window in Pixels


  <uResize>    Action that will be performed when the Window is resized.
               <bResized> will be stored in oWin:bResized and receives two
               Parameters on Evaluation:

                <nWidth>    The new width of the window in pixels
                <nHeight>   The new height of the window in pixels

  <uPaint>     Generally drawing action to be performed every Time that
               the Window is repainted ( iE the window receives a WM_PAINT
               message from Windows). 
               When <bPainted> is called it receives two Parameters:
      
                      hDC    the Window Device Context Handle
                      cPS    Window PAINTSTRUCT as a String

                which is defined as bPainted  := {|hDC, cPS |uPaint}.


  <uKeyDown>   Whenever a nonsystem key is pressed, the WM_KEYDOWN message 
               is sent which then calls this Action.
               Please press  Related Topics:  and select  WM_KEY  for
               detailed informations about the topic and parameters
               

  <uInit>      This Action is performed after our Window is displayed for
               the first Time, so the ON INIT Clause is a prime Candidate
               for Initialisation off all kind. 
               Defined as oWin:bInit := {|Self|uInit}, the Codeblock 
               receives a reference to the WindowObject <oWin> as a sole
               Parameter.


  <uUp>        If our Window has a Vertical Scrollbar, this Action will
               be performed when the 'up' arrow of this scrollbar is clicked 
               upon. Defined as oVScroll:bGoUp := {||uUp}, it receives no 
               Parameters.

  <uLeft>      Same as <uUp> but for a horizontal Scrollbar

  <uDown>      If our Window has a Vertical Scrollbar, this Action will
               be performed when the 'down' arrow of the scrollbar is clicked 
               upon. Defined as oVScroll:bGoDown := {||uUp}, it receives 
               no Parameters.

  <uRight>     Same as <uDown> but for a horizontal Scrollbar

  <uPgUp>      If our Window has a Vertical Scrollbar, this Action will
               be performed when the scrollbar is clicked above the Scrollbox
               iE it receives a PAGEUP Message. 
               Defined as oVScroll:bpageUp := {||uPgUp}, it receives no 
               Parameters.

  <uPgDown>    Same as <uPgUp> but for the PAGEDOWN Message

  <uPgLeft>    If our Window has a Horizontal Scrollbar, this Action will be
               performed when the scrollbar is clicked left of the Scrollbox
               iE it receives a PAGELEFT Message. 
               Defined as oHScroll:bpageUp := {||uPgLeft}, it receives no 
               Parameters.

  <uPgRight>    Same as <uPgLeft> but for the PAGERIGHT Message


  <DropFiles>   This Action is performed whenever files are dropped on
              the window. Defined as {|nRow,nCol,aFiles|uDropFiles}, it
              receives three parameters:

                <nRow>    The row (in pixels) where the file(s)
                           were dropped

                <nCol>    The column (in pixels) where the
                           file(s) were dropped.

                <aFiles>  An Array which contains the filenames of all
                           files that were dropped on the window.



    DESCRIPTION:

     This command displays the Window <oWin> and starts interacting with 
     it through the main application event loop. 
     If you want to launch Actions on special Events, just set up some Code 
     which will automatically "Blockified" by the Preprozessor and then
     stored inside your Window. If the according Event happens, your
     'Call-Back' Action will be performed.

     You can separate Statements with Semicolons, like in
  
     +-------------------------------------------------------------+
     | VALID( ExitMyCode(), ( snExit == 1) )                       |
     +-------------------------------------------------------------+

     such Expressions should be encloded by Brackets, where the last 
     Statement/Function will generate the Action's Return Value
     ( in the above Sample TRUE if snTest == 1 )

     If your Actionblock gets is defined with a Parameters, then you 
     can directly refer to this Parameters in your Code, like in

     +-------------------------------------------------------------+
     |  ACTIVATE WINDOWS oWin ;                                    |
     |    ON LEFT CLICK MsgInfo( "Hit at row " + STR( nRow ))      |
     +-------------------------------------------------------------+

     where nRow is hardcoded to the bLClick Codeblock and directly used
     in the ActionCode

     A very interesting Feature is the DropFile Event: Windows offers the 
     capability to select one or more files from the File Manager and drop
     this files over a window. 
     This way, you can easily develop highly context sensitive applications,
     that may perform many different actions when they receive different 
     kinds of files !
              


   EXAMPLE:

     +-------------------------------------------------------------+
     |  /* This will ask if the user wants to exit your App */     |
     |   ACTIVATE WINDOW oWin ;                                    |
     |      VALID MsgYesNo( "Wanna leave me <sniff> ?" )           |
     |                                                             |
     |  /* This will Minimize a Window instead of closing it */    | 
     |   ACTIVATE WINDOW oWin ;                                    |
     |      VALID ( oWin:minimize(), .F. ) ;                       |
     |                                                             |
     |  /* will draw a frame on the window. Not the hDC is         |
     |     hardCoded into bInit */                                 |
     |   ACTIVATE WINDOW oWin ;                                    |
     |    ON PAINT WndBoxIn( hDC, 10, 15, 50, 300 )                |
     |                                                             |
     |  /* This will Browse a DBF which is dragged from the File   |
     |     File Manager and dropped on the Window. aFiles is also  |
     |     a hardcoded Parameter that is automatically suplied */  |
     |   ACTIVATE WINDOW oWin ;                                    |
     |         ON DROPFILES Browse( aFiles[1] )                    |
     |                                                             |
     +-------------------------------------------------------------+


See Also: ACTIVATE DIALOG WM_BUTTON WM_KEY PAINTSTRUCT
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson