Documentation for Win32lib v0.60.6
Table of Contents

Events

Events are routines that are triggered in response to actions taken by the user.


Application events, like mouse clicks, key presses, resizing windows, and so on, are the basis for invoking user-developed routines. Once an application calls WinMain, Windows takes over and only runs the user code when an event, that has been nominated by the user, occurs. To nominate which events the application wishes to respond to, the application must register event handlers for each control/event combination that is relevent.

To establish an event handler, you use the setHandler() routine. This links together three things: A control, an Event Type, and a Routine that you write.
Example:

      setHandler(okButton, w32HClick, routine_id("myClickHandler"))

The event handler routine that you write is always passed three parameters:
integer self This is the id of the control that triggered the event.
integer event This is the Win32lib code for the event type that was triggered.
sequence parms This is zero of more parameters that are specific to the type of event being triggered.

A given event handler can be shared by many controls. In this case, you can use the self and event parameters to determine your actions.

   procedure myClickHandler(integer self, integer event, sequence parms)
       if self = okBtn then
          . . .
       else
          . . .
       end if
   end procedure
   setHandler({okBtn,cancelBtn}, w32HClick, routine_id("myClickHandler"))

  • proc AppCallback(integer self, integer event, sequence parms)   An application specific callback routine used by win32lib.
  • proc closeApp()   Closes the application down.
  • proc doEvents(integer id)   Gives control back to windows until there are no pending events to process.
  • func getHandler( integer id, integer htype)   Gets the event handler(s) defined for a control.
  • func getLastMsg( object option )   Gets information about the Windows message(s) being processed.
  • func getReturnValue( )   Gets the current value of the value that will be returned to Windows.
  • func invokeHandler( integer id, integer event, sequence params)   Triggers a Win32Lib event.
  • func main(sequence pArgs)    An optional application routine, called within w32start.ew just prior to Windows gaining control.
  • func onXXX( integer flag )   Sets the support for the onXXX[] syntax.
  • proc removeHandler( object id, object htype, object routine)    Removes user written event handlers previously set with setHandler()
  • proc resetReturnValue( )   Removes any value returned by handler.
  • proc returnValue( value )   Override default value returned by handler.
  • func setCallback( integer routineID)   gets and sets the application's generic callback routine id
  • func setDefaultProcessing(integer NewId)   This establishes a replacement routine to handle the Windows default processing.
  • func setEventLoop(integer NewId, object UserData)   This establishes an replacement event loop.
  • proc setHandler( object id, object htype, object routine)   Sets up an user written event handler
  • func setIdle(integer newvalue)   Sets whether or not the library implements w32HIdle
  • func setMouseClick(object pTimeDelta, object pXDelta, object pYDelta)    Sets/gets the mouse click detection parameters.
  • func setNotifyHandler(integer pMsg, integer pRtnId)   Sets a handler for WM_NOTIFY type of messages.
  • proc setWinMsgHandler(object id, object pMsg, integer pRtnId)   Sets a user defined (raw) windows message handler.
  • proc startApp(object CallbackRtns)   Start the application running.
  • func subClassControl(sequence Id, atom hWnd)   Used to access Windows created controls as if they were win32lib controls.
  • const w32HActivate   Occurs for Windows only and after the window is opened.
  • const w32HAfterEvent   Occurs after normal Windows processing of an event (any type).
  • const w32HBreak   Invoked whenever the Ctrl-Break key is pressed.
  • const w32HChange   Selection or Value in a control is changed.
  • const w32HClick   Invoked when the left mouse button is 'clicked' or a Button control is used.
  • const w32HClose    A Window is closed.
  • const w32HCloseUp   The dropdown portion of a combobox has just been closed.
  • const w32HDataChange   Value in a List or a Combo's list has changed.
  • const w32HDestroy   The control is about to be destroyed.
  • const w32HDragAndDrop   Something has been dragged onto the control or window.
  • const w32HDropDown   The dropdown portion of a combobox is about to be displayed.
  • const w32HEvent   An event (any type) has occured.
  • const w32HGotFocus    A control (or Window) receives focus.
  • const w32HIdle   Invoked whenever the application is not processing Windows messages.
  • const w32HKeyDown   Key is pressed.
  • const w32HKeyPress   "Printable" key is pressed.
  • const w32HKeyUp   Key is released.
  • const w32HLostFocus    A Window or control loses focus.
  • const w32HMouse   Event triggered when a mouse action takes place.
  • const w32HMouseTrap    Event triggered when a mouse action takes place inside a defined MouseTrap for a control.
  • const w32HNotify   A control is forwarding a notification event.
  • const w32HOpen    A Window is opened.
  • const w32HPaint    A portion or all of a Window needs to be redrawn.
  • const w32HPause   Invoked whenever the Pause key is pressed.
  • const w32HResize    A Window has been resized.
  • const w32HScroll   Triggered when scrollbar value has changed, and when user has stopped scrolling.
  • const w32HTimer   A timer is triggered.
  • incl w32Start (w32start.ew)    This is an optional include file. It defines a default application callback routine

    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    AppCallback
    (integer self, integer event, sequence parms)

    An application specific callback routine used by win32lib.

    Category: Events

    This is an optional routine that if defined, must be a global routine in your Win32Lib application. It is used by the include file w32start.ew

    It is called by Win32Lib when the library needs some details from the application.

    see setCallback for more details.

    Example:

      procedure AppCallback(integer self, integer event, sequence parms)
          if event = w32HGetHandler then
              -- parms[1] is the standard routine handler name
              -- in the form _
              -- eg. Click_PushBtn
              -- parms[2] is the event code to be handled
              -- eg. w32HClick
              -- parms[3] is the control's name
              if match("About", parms[3]) then
                  returnValue(routine_id(parms[1]))
              else
                  -- Non standard naming
                  returnValue(routine_id("menu_item_selected" ))
              end if
          end if
      end procedure
    

    See Also: closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    closeApp
    ()

    Closes the application down.

    Category: Events

    You can set a handler to trap the close of the main window if you have any last minute activites to do, such as closing databases, etc...

    Example:

          procedure Click_CloseBtn(integer self, integer event, sequence parms)
              if message_box("Is it okay to stop now?", "Close", MB_YESNO) = IDYES
                  closeApp()
              end if
          end procedure
          setHandler(CloseBtn, w32HClick, routine_id("Click_CloseBtn"))
    

    See Also: AppCallback, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    doEvents
    (integer id)

    Gives control back to windows until there are no pending events to process.

    Category: Events

    id is usually zero, meaning that events for all controls are processed, however you can limit this to a particular control by supplying it id.

    Typically this is used inside user written event handlers when they know that they might take a long time to complete. For example, if by clicking a button the application must scan through all the files on a disk, it would be appropriate to include a doEvents() call inside the inner loop so that other windows events can be processed during the file search. If this isn't done, no control or window belonging to the application will respond until the disk scan is conpleted. For example, there might be another button that the user can click to abort the disk scan. Without doEvents() this would only respond after the disk scan is completed!

    See Also: AppCallback, closeApp, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getHandler
    ( integer id, integer htype)

    Gets the event handler(s) defined for a control.

    Returns: SEQUENCE: A list of handlers defined so for this control event.

    Category: Events

    id is the ID of the control that the event applies to.
    htype is the type of event being handled.

    Example

           object hl
           -- Make sure my handler is installed before any others.
           hl = getHandler(myWindow, w32HPaint)
           -- Chain mine to the front.
           setHandler(myWindow, w32HPaint, -1 & routine_id("mypainter") & hl)
    

    See Also: AppCallback, closeApp, doEvents, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getLastMsg
    ( object option )

    Gets information about the Windows message(s) being processed.

    Returns: SEQUENCE: The message data sent by Windows. INTEGER: Depth

    Category: Events

    This is used by advanced users. It can be used to determine the triggering event for the current event handler. For example, you can use this to find out if a w32HClick event was triggered by a keypress or a mousepress. Or if a paint event was triggered by a scroll action or not.

    What this returns depends on the option value.

  • "" Returns the most recent message { pSource, hWnd, iMsg, wParam, lParam }
  • "all" Returns all the messages being processed. { Mes, ... } where each Mes has the form above.
  • "depth" Returns the current number of messages being processed.
  • "maxdepth" Returns the maximum number of simultaneous messages processed so far.

    This returns an empty list if there are no windows messages being processed.

    Example:

          sequence msg
          msg = getLastMsg( "" )
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getReturnValue
    ( )

    Gets the current value of the value that will be returned to Windows.

    Returns: OBJECT: A sequence if set by an event handler, otherwise an atom.

    Category: Events

    Example:

          object rv
          -- Set a return value if not already set.
          rv = getReturnValue()
          if not sequence(rv) then
              returnValue(-1)
          end if
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    invokeHandler
    ( integer id, integer event, sequence params)

    Triggers a Win32Lib event.

    Returns: OBJECT: The value set by returnValue() if called inside

    Category: Events

    the handler, zero otherwise.

    Example:

          object rv
          -- Simulate a button press on the Close Button.
          rv = invokeHandler(btnClose, w32HClick, {})
          if not sequence(rv) then
              closeWindow(mainWin)
          end if
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    main
    (sequence pArgs)

    An optional application routine, called within w32start.ew just prior to Windows gaining control.

    Returns: INTEGER: 0 if you want the app to start, otherwise anything else will abort.

    Category: Events

    This is an optional routine that you can define in your application. If you do, it is called by the include file w32start.ew just prior to passing control to Windows.
    It is passed the output of the command_line() routine.
    If it returns a zero, then the application will start up. Anything else will cause the application to abort.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    onXXX
    ( integer flag )

    Sets the support for the onXXX[] syntax.

    Returns: INTEGER: The current setting of this support.

    Category: Events

    By default, the library supports the onXXX syntax but this will change with version 0.70. From then, the default will be not to support this interface and then you will have to explictly turn it on via this function.

    Support for the onXXX syntax will be removed from the library from version 1.0 onwards.

    Note: Using onXXX support is much slower than using the setHandler() syntax.

    If you choose to turn onXXX support off, you must use setHandler() and all your onXXX[] routine_ids will be ignored.

    Also note that any call to setHandler will turn off onXXX support. So if you need to mix both syntaxes, you must call onXXX(1) after your last setHandler() call.

    Example:

          integer lOld
          -- Turn off onXXX support.
          lOld = onXXX (w32False)
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    removeHandler
    ( object id, object htype, object routine)

    Removes user written event handlers previously set with setHandler()

    Category: Events

    id is one or more control IDs.
    htype is one or more event types.
    routine is one or more routine_ids previously set for the control-event combinations in the previous parameters.

    You use this routine to get rid of a handler that had been established earlier.

    Example:

          removeHandler( {Btn1, Btn2}, w32HClick, routine_id("CommonHandler"))
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    resetReturnValue
    ( )

    Removes any value returned by handler.

    Category: Events

    Example

          resetReturnValue()
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    returnValue
    ( value )

    Override default value returned by handler.

    Category: Events

    This allows you to override the value an event handler returns to Win32. By default, when an event is processed, it goes through these steps:

  • onEvent: If there is an onEvent handler for this control, it is passed the event.
  • Event Trap: If there is a specific handler for this event, that handler is triggered. For example, WM_SETFOCUS triggers onGotFocus, WM_SIZE triggers onResize, etc.
  • Default Windows Handler: Finally, the default Window handler for the control is called. In the case of subclassed controls, CallWindowProc calls the normal handler; for windows, DefWindowProc is called.

    Setting returnValue causes processing to stop at the step that the value was set in, and return that value to Windows.

    Example:

              -- prevent Button1 from seeing any space bar keys
              procedure Button1_KeyDown( integer self, integer event, sequence parms)
                  integer keycode
                  integer shift
                  keycode = parms[1]
                  shift = parms[2]
                  if keycode = VK_SPACE then
                      -- set return value
                       returnValue( w32True )
                  end if
              end procedure
               setHandler( Button1, w32HKeyDown, routine_id("Button1_KeyDown"))
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setCallback
    ( integer routineID)

    gets and sets the application's generic callback routine id

    Returns: INTEGER: The current value of the application's callback routine id.

    Category: Events

    routineID is either -1 or a valid routine id.
    This sets the application's callback routine id and returns the old value.
    The application may call the callback routine for a number of reasons during the running of a program. It is mainly used to get information needed by Win32Lib that it has not received so far.

    The callback routine must be a procedure that takes three parameters:-
    integer self
    integer event
    sequence data

    The contents of the parameters passed to the callback routine depend on the value of the event parameter.
    When event = w32HGetHandler is called when Win32lib needs an event handler to be associated for a specific control's event. This comes about when using the "events=..." parameter in the newUIObj routine./n The data contains three values...
    [1] A string in the form <eventname>_<controlname>, eg. "Click_OkayBtn"
    [2] An integer with the symbolic event code, eg. w32HClick
    [3] A string containing the control's name.
    And the self parameter contains the control-id for the control needing the handler routine.

    Example

          integer oldrtn
          oldrtn = setCallback(routine_id("AppCallback"))
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setDefaultProcessing
    (integer NewId)

    This establishes a replacement routine to handle the Windows default processing.

    Returns: INTEGER: The previous routine_id for this.

    Category: Events

    The Windows Default Processing routine is called whenever a message is received for a control that Win32lib does not explicitly handle. Win32lib will pass a number of parameters to this routine.

  • integer id: The win32lib ID for the control. It will be zero if it is not a control that was created with win32lib.
  • integer pSource: A code that indicates the source of the message. It is either kMainMsg or kSubClassedMsg depending on whether it comes from a top-level window or a control within a window respectively.
  • atom hWnd: The handle to the control.
  • atom iMsg: The Windows message code.
  • atom wParam: The first data item for the message code.
  • atom lParam: The second data item for the message code.

    Example:

      function MyDefaultProc(integer id, integer pSource, atom hWnd,
                             atom iMsg, atom wParam, atom lParam)
          atom lResult
    

    if (id = 0) or (pSource = kMainMsg) then lResult = w32Func( xDefWindowProc, { hWnd, iMsg, wParam, lParam } ) else lResult = w32Func( xCallWindowProc, { mySubProc, hWnd, iMsg, wParam, lParam } ) end if

    return lResult end function VOID = setDefaultProcessing(routine_id("MyDefaultProc"))

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setEventLoop
    (integer NewId, object UserData)

    This establishes an replacement event loop.

    Returns: SEQUENCE: The previously set values = {message handler routine id, user data}

    Category: Events

    There may be situations in which the Windows Message handler loop, built into Win32lib, is not adequate for your needs. If so, you can call this function to supply an alternative message handler.

    NewId is the routine_id of your routine that will be called by Win32lib to process Windows Messages.

    UserData can be anything. It is passed back to your routine by Win32lib on each call. Win32lib does not alter it at anytime.

    Win32lib calls the message handler from within the MainWin() routine to begin processing messages received from Windows. It also calls it when you use openDialog(). The replacement message handler will receive the UserData value every time it is called by Win32lib.

    Example:

      integer OldHandler
      procedure myMsgHandler(sequence Parms)
         . . . your code goes here . . .
      end procedure
      OldHandler = setEventLoop( routine_id("myMsgHandler"), {})
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setHandler
    ( object id, object htype, object routine)

    Sets up an user written event handler

    Category: Events

    id is the ID of the control that the event applies to.
    htype is the type of event to trap.
    routine is the routine_id of the user written code that will handle the event.

    Note that id can be a sequence of ids. You would do this if they all shared the same handler code.
    Note that htype can be a sequence of event codes. You would do this if the same handler code is to be invoked for different events.
    Note that routine can be a sequence of routine_id() values. You would do this to set a chain of routines that are triggered for each event listed in htype.
    This routine actually adds the handler's routine_id to the end of a list of such routines for this ID and Event combination. This way, you can chain together independantly written routines to fire for the same id and same events.

    A special note. To remove the current chain, set routine to -1. To clear the existing chain before setting a new one, you can also pass routine as {-1, routine_id("myhandler")}

    How the Event Handler subsystem works
    The Win32lib library receives various events notifications from Windows. If an event handler has been set up for the specific control-event combination, the library invokes the user written routine before continuing. Each event handler is a procedure that is passed three parameters by the library.
    1) integer ID. The control id that the event applies to.
    2) integer Event. The event code that invoked this routine. This enables a single routine to handler multiple event types.
    3) sequence Params. This is a list of zero or more parameters associated with the specific event. For example, a w32HKeyDown event will have the keycode and shift mask in these parameters.

    Example

      -- Set a single routine to be triggered by one type of event.
      setHandler(myWindow, w32HPaint, routine_id("repaintWindow"))
    

    -- Set the same handler for two different buttons. setHandler( {btn1, btn2}, w32HClick, routine_id("click_buttons"))

    -- Set the same handler for two different events. setHandler( btn1, {w32HClick, w32HKeyPress}, routine_id("click_buttons"))

    -- Set a chain of handlers. setHandler( btn1, w32HClick, routine_id("click_buttons")) if DebugSwitch = w32True then -- add a second routine to be called. setHandler( btn1, w32HClick, routine_id("Debugger")) end if

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setIdle
    (integer newvalue)

    Sets whether or not the library implements w32HIdle

    Returns: INTEGER: CurrentValue

    Category: Events

    newvalue is either w32True or w32False
    The initial setting is w32False, meaning that w32HIdle is not invoked when the application is idling. To start having this handler invoked, you need to setIdle(w32True).

    example

      integer x
      x = setIdle(w32True)
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setMouseClick
    (object pTimeDelta, object pXDelta, object pYDelta)

    Sets/gets the mouse click detection parameters.

    Returns: The current settings for these parameters.

    Category: Events

    There are three parameters used to detect a mouse click event. These are

  • Time: Number of seconds difference between left mouse down and up events.
  • XDelta: Number of pixels allowance in the X (horizontal) direction.
  • YDelta: Number of pixels allowance in the Y (vertical) direction.

    By using this function, you can set any, all, or none of these parameters. To not set a parameter, you must use an empty sequence in its place.

    example:

         -- Set the time to 1.5 seconds, and the Y tolerance to 5 pixels.
         -- Leave the X tolerance as it is.
         curval1 = setMouseClick( 1.5, {}, 5)
         -- Double the X tolerance, leaving the others alone.
         curval2 = setMouseClick( {}, curval1[2] * 2, {})
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    setNotifyHandler
    (integer pMsg, integer pRtnId)

    Sets a handler for WM_NOTIFY type of messages.

    Returns: INTEGER: The current Routine ID for this notification message.

    Category: Events

    pMsg is the Notification Message code for which you are setting the handler.
    pRtnId is the routine_id() of your function that handles the message.

    Your routine is passed four parameters:

  • integer id = The ID of the control that is sending the notification.
  • atom hWnd = a copy of the hWnd parameter sent by Windows.
  • atom wParam = a copy of the wParam parameter sent by Windows.
  • atom lParam = a copy of the lParam parameter sent by Windows. and must return either kSubclassedMsg or kMainMsg
    kSubclassedMsg means that you want the windows processing specific to this class of control to occur for this notification, after your code has finished. A variation is to return {kSubclassedMsg, {hWnd,iMsg,wParam,lParam}} that contain replacement values for the ones originally send through by Windows.
    kMainMsg means that you want the Windows default processing to occur, skipping any class specific behaviour. This will send a zero return code back to the Windows from the WM_NOTIFY message. Sometimes however, you may need to specifies a specific return value. In this case you need to return {kMainMsg, retval} in which retval must be an integer. Example:
      sequence alldata
      integer oldval
      integer SORT_BY
      SORT_BY=0
      alldata = getDataItems()
    

    function CS_byElement(sequence s1,sequence s2) return compare(s1[SORT_BY],s2[SORT_BY]) end function

    constant ByElement=routine_id("CS_byElement")

    function mylvclick(integer id, atom hWnd, atom wParam, atom lParam) integer lColumn, lOwner

    id = getId( w32fetch( lParam, NMHDR_hwndFrom )) if id != 0 then lColumn = w32fetch( lParam, NMLISTVIEW_iSubItem ) + 1 SORT_BY=lColumn alldata=custom_sort(ByElement,alldata) VOID = sendMessage(id,WM_SETREDRAW,0,0) loadLVInfo(id, alldata) VOID = sendMessage(id,WM_SETREDRAW,1,0) end if

    return kMainMsg end function oldval = setNotifyHandler( LVN_COLUMNCLICK, routine_id("mylvclick"))

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setWinMsgHandler
    (object id, object pMsg, integer pRtnId)

    Sets a user defined (raw) windows message handler.

    Category: Events

    Use this to set up a handler to directly deal with a Windows message prior to win32lib processing it. This is really only used by experienced Windows coders as it must deal with all the low-level detail itself.

    id can be either a single control Id or a list of them.
    pMsg can be either a single Windows message code or a list of them. The pRtnId is a routine_id of some code of yours which must be a function that receives these parameters ...

    1. integer pSource
    2. atom hWnd
    3. atom iMsg
    4. atom wParam
    5. atom lParam
    The pSource parameter is either kMainMsg if this is a subclassed control, or kSubclassedMsg if this is a window or non-subclassed control.
    If your handler routine returns a sequence then win32lib does not process the message and the first element in the sequence is returned to Windows.

    Note that if pRtnId is -1 then this removes a previously set message handler.

    Example:

      function myhandler(integer pSource, atom hWnd, atom iMsg, atom wParam,  atom lParam)
         if wParam = VK_ENTER then
           if iMsg = WM_KEYDOWN then
             ...
           else -- WM_KEYUP
             ...
           end if
         end if
         return {0}
      end function
      setWinMsgHandler( myFld, {WM_KEYDOWN, WM_KEYUP}, routine_id(myhandler))
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    startApp
    (object CallbackRtns)

    Start the application running.

    Category: Events

    This opens the main window, setting focus on the first 'focusable' control and then handles over control to Windows.

    The CallbackRtn parameter is either a single routine_id or a list of three routine_ids.
    If it is a single routine_id is can be either w32NoCallBack or the routine id of a callback routine inside your application. See setCallback for more details.

    If CallbackRtns is a list of three routine_ids, it takes the format of ...

  • integer AppCallback: Same as the single routine_id version above.
  • integer AlternateCAllback: If AppCallback is -1 then this is used instead.
  • integer AppMain: Either -1, or a routine_id of a routine that is called prior to the library start up. The AppMain routine is passed a single sequence, which is the command_line() parameters. If AppMain returns a zero then the library continues executing otherwise the library stops immediately.

    Example:

      startApp({routine_id("AppCallback"), routine_id("LocalCallback"), routine_id("AppMain")})
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    subClassControl
    (sequence Id, atom hWnd)

    Used to access Windows created controls as if they were win32lib controls.

    Category: Events

    return INTEGER: A win32lib control id. ZERO if it fails. Id is a sequence {ControlType, ParentID}
    hWnd is the Windows Handle to the control.

    Example

          -- Use an edit fld that was created outside of win32lib as if it was
          -- a normal win32lib control.
        newid = subClassControl( {EditText, myWindow}, winhandle)
    

    -- Use an external bitmap as if it was a pixmap. bmh = loadBitmapFromFile("..\\demoresources\\java.bmp") myPixMap = subClassControl({Pixmap, 0}, bmh) setPenColor(myPixMap, Cyan) drawRectangle(myPixMap, 1, 0, 0, 40, 40)

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HActivate

    Occurs for Windows only and after the window is opened.

    Category: Events

    parms = {}

    This is typically triggered by WinMain, or openWindow. It differs from w32HOpen in that it is triggered after a window is opened but before control is returned to your application.

    Typically, code that is run at this point does a setFocus or other initialization..

    This event is only triggered for a Window.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HAfterEvent

    Occurs after normal Windows processing of an event (any type).

    Category: Events

    parms = { atom winmsg, atom wParam, atom lParam, atom lWinReturn }

    After the message is processed by the Windows, Win32lib, and any event handlers, this is triggered.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HBreak

    Invoked whenever the Ctrl-Break key is pressed.

    Category: Events

    parms = {integer keyCode, integer shift}

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HChange

    Selection or Value in a control is changed.

    Category: Events

    The contents of parms varies with the type of control. Note that they are only available when using the setHandler() interface.

    For the List and Combo family of controls the parms are ...
    { Event qualifier (integer), Index of affected item (integer) }
    Note that the event qualifier is always 'w32CHG_Sel' at this stage.

    For ListView the parms are ...

    For MonthCalendar the parms are ... if the event is invoked by a date change cuased by pressing one of the prev/next buttons or by paging up/down etc, then the parms are an empty sequence.
    If the event is invoked by an explicit date or date range being clicked then the parms returns two dates.

    Note, for Combo box controls, this is triggered when either the edit box area has been changed by the user, or when the list item selection is about to change. If the user is editing the edit box area then getText will return the current value of the edit box, but if this event was triggered due to the user selecting a new item, getText will return the previously selected item and you must use getItem(id, 0) to retrieve the new selection value.

    To determine the new value of the control, use the appropriate function - getText, isChecked, getIndex etc.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HClick

    Invoked when the left mouse button is 'clicked' or a Button control is used.

    Category: Events

    parms = { }

    This event is triggered when a PushButton, CheckBox or TabItem is clicked, or by a MenuItem selection.

    It is not the same as a Mousedown event. For a click to happen, the left mouse down and up events must be in the same control, be no more than 2 pixels from each other, and the up event must be within a double-click period of the down event.

    The use of accelerator keys, generates a mouse click event.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HClose

    A Window is closed.

    Category: Events

    parms = {}

    This typically occurs via closeWindow, although the user can select the close control on the window as well.

    Closing a window does not actually destroy it (unless it is the main window; the window is merely hidden. Refer to closeWindow for more details.

    If the onClose routine calls returnValue() with a non-zero parameter, win32lib aborts the Close operation, as if it hadn't been invoked. In this way it is possible to do a conditional close.

    This event is only triggered for a Window.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HCloseUp

    The dropdown portion of a combobox has just been closed.

    Category: Events

    parms = {}

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HDataChange

    Value in a List or a Combo's list has changed.

    Category: Events

    parms is { eventqual, index }

    Note this event is only available when using the setHandler() interface.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HDestroy

    The control is about to be destroyed.

    Category: Events

    parms = {}

    This is triggered when destroy() has been called and before the control is actually destroyed. It is designed for the application to perform any cleaning up that might be required.

    If the event handler return -1, then the control is not destroyed. This enables the application to prevent a control from being destroyed.

    Note, when the main window is closed, the destroy routine is called automatically as well.

      procedure onDestroy_MsgWnd(integer self, integer event, sequence parms)
         -- Don't allow it to go until the messages have been
         -- acknowledged by the operator.
         if vMsgAcknowledged = w32False then
            returnValue(-1)
         end if
      end procedure
      setHandler(MsgWnd, w32HDestroy, routine_id("onDestroy_MsgWnd"))
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HDragAndDrop

    Something has been dragged onto the control or window.

    Category: Events

    parms = { integer id, sequence data }

    This is triggered by the user dragging and dropping a file or a ListView or TreeView item onto a control or window.

    If id is zero, then windows is dropping one or more files onto the control or window. In this case, the handler is called multiple times:
    In the first call, data contains one integer. This is the number of files about to be passed to your handler routine.
    Then your handler routine is called once per file being passed.
    The final call to the handler is when data is an empty sequence. This signifies that no more files will be passed.

    For example, the following code adds the name of the files to TheList.

          integer vFileCount
          procedure dropped( integer self, integer event, sequence parms )
              if parms[1] = 0 then
                  if length(parms[2]) = 1 then
                      -- Opening call, the file count.
                       setEnable(actionButton, w32False)
                      eraseItems(TheList)
                      vFileCount = parms[2]
    

    elsif length(parms[2]) = 0 then -- Final call. setEnable(actionButton, w32True)

    else -- add the file name to the list addItem( TheList, parms[2] ) end if end if end procedure setHandler(TheList, w32HDragAndDrop, routine_id("dropped"))

    If id is not zero, then it is the Win32Lib id of the control from which items have been dragged. The second parameter is a sequence of the item id's.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HDropDown

    The dropdown portion of a combobox is about to be displayed.

    Category: Events

    parms = {}
    This can be used to dynamically load the values into a combobox.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HEvent

    An event (any type) has occured.

    Category: Events

    parms = { atom winmsg, atom wParam, atom lParam }

    Before the events are processed by any of the trap routines or default Windows routines, the w32HEvent is triggered.

    If you want to skip the default Windows processing of the winmsg, pass a value to the returnValue() routine.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HGotFocus

    A control (or Window) receives focus.

    Category: Events

    parms = {}

    Focus means that keyboard events are directed to that control. Static controls (such as LText) cannot get focus.

    When a Win32Lib window gets focus, it will give focus back to the last control in the window that had focus. If there are no controls in the window that can recieve focus, the focus will remain with the window.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HIdle

    Invoked whenever the application is not processing Windows messages.

    Category: Events

    parms = {integer Counter, atom MsgAddr}

    Your application will only start getting these events once you have called setIdle(w32True).

    The Counter starts at 1 for each time the handler is invoked after the Windows Message Queue becomes empty again. That is, this handler will be invoked repeatedly, while there are no messages to be processed. You can tell when you application becomes idle when the Counter value is 1. Values higher than 1 indicate that the application is still idle. When the application becomes active again, the handler is called with a Counter value of -1 and the MsgAddr contains the message that 'woke up' the application.

    When the value of Counter is greater than -1, the MsgAddr is the address of the Msg structure that contains the last Windows message before becoming idle. When the Counter is -1, this contains the message that is about to be processed.

    If your handler routine calls returnValue, passing any value, this will immediately wake up your application and cause it to process the information contained in the structure pointer to by MsgAddr. This means that you are expected to place into this structure, valid data to simulate a Windows event.

    Note: This event is not supported by the onXXX[] interface.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HKeyDown

    Key is pressed.

    Category: Events

    parms = {integer keyCode, integer shift}

    The keyCode is "raw" value of the key. The primary purpose of onKeyDown is to trap "special" keys not reported by onKeyPress.

    The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed. The masks for each key are:

  • ShiftMask
  • ControlMask
  • AltMask

    For example, to see if the Shift+Backspace key was pressed, you could write:

    -- shift+backspace?
    if  and_bits( shift, ControlMask )
    and keyCode = VK_BACK then
    -- shift+backspace held
    end if
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HKeyPress

    "Printable" key is pressed.

    Category: Events

    parms = { integer keyCode, integer shift}

    The keyCode is ANSII value of the key. Only "visible" keys are reported with this function. To trap "special" keys (such as the cursor keys), use onKeyDown.

    For example:

          -- is it the letter 'a'?
          if keyCode = 'a' then
              -- it's the letter a
          end if
    

    The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed. The masks for each key are:

  • ShiftMask
  • ControlMask
  • AltMask

    For example, to see if the control key is held down, you could write:

    -- control key held down?
    if and_bits( shift, ControlMask ) then
    -- control key is held down
    end if
    

    If you want to to Windows to ignore the key, set the return value to -1.

    if find(keyCode,"0123456789") then
    returnValue(-1) -- ignore digits.
    end if
    

    If you want to to Windows to use a different key, set the return value to the new key.

    -- collect characters into the password, but don't show them.
    PassWord &= keyCode
    returnValue('-') -- return a dash for each character entered.
    

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HKeyUp

    Key is released.

    Category: Events

    parms = {integer keyCode, integer shift}

    The keyCode is the raw scan code value of the key. Use the VK_ constants to determine the value of the key.

    The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed.

    See onKeyDown for details.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HLostFocus

    A Window or control loses focus.

    Category: Events

    parms = {focusControl}
    focusControl is the id of the control that had the focus. This is normally the same as the self parameter but in the case where self is a parent Window focusControl is the control within that window that had focus.

    Note: That focusControl parameter is not supported with the onXXX interface.

    Focus means that keyboard events are directed to that control. See onGotFocus.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HMouse

    Event triggered when a mouse action takes place.

    Category: Events

    parms = { integer event, integer x, integer y, integer shift, integer wheelmove }

    The event parameter will be one of the following values:

  • MouseMove: the mouse was moved
  • LeftDown: the left mouse button was pressed
  • RightDown: the right mouse button was pressed
  • LeftUp: the left mouse button was released
  • RightUp: the right mouse button was released
  • LeftDoubleClick: the left mouse button was double clicked
  • RightDoubleClick: the right mouse button was double clicked
  • WheelMove: The mouse wheel has moved.

    The x and y parameters specify where the mouse is located. If the mouse has been grabbed (see captureMouse), the values of x and y can be negative if the mouse is outside the client area.

    The shift parameter has bits set indicating the if the keyboard shift, control, and alt keys are pressed, and which mouse button was pressed.
    The masks are:

  • ShiftMask --> Left and/or Right Shift key down
  • ControlMask --> Left and/or Right Control key down
  • AltMask --> Left and/or Right Alt key down
  • KeyMask --> Any of the Shift/Control/Alt keys down.
  • LeftBtnMask --> Left mouse button down.
  • RightBtnMask --> Right mouse button down.
  • MiddleBtnMask --> Middle mouse down.
  • BtnMask --> Any mouse button down.

    -- Is one of the shift keys is held down?
    if and_bits( shift, ShiftMask ) then
    . . .
    end if
    -- Check for the combination Ctrl and Right Mouse.
    if and_bits( shift, ControlMask+RightBtnMask ) then
    . . .
    end if
    

    NOTE wheelmove is not supported for the onXXX interface, only the setHandler interface is supported.
    The WheelMove parameter describes the direction and size of the mouse wheel movement. A value greater than 0 means that the wheel moved 'up' or away from the user, and a value less than zero means the wheel moved 'down' or towards the user. And of course, a value of 0 means that it didn't move at all.
    The speed, or size, of the movement is the absolute value of this parameter. You can use this in conjunction with getWheelScrollLines() to work out how the mouse wheel movement should effect your application.

    Example:

       TopLine += parms[5] * getWheelScrollLines()
       RefreshDisplay()
    

    Special Note: If you call returnValue(0) inside your mouse handler routine, this has the effect of causing the control that received the mouse event to ignore it. This is only needed in rare circumstances where your processing of the mouse event interferes with the control's normal processing. For example, if you trap a Right Down event to cause a popup menu to show, sometimes you also need to tell the underlying control to ignore the button down event 'cos you used it.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HMouseTrap

    Event triggered when a mouse action takes place inside a defined MouseTrap for a control.

    Category: Events

    parms = { integer event, integer x, integer y, integer z, sequence traps, integer id }

    The event parameter will be one of the following values:

  • MouseMove: the mouse was moved
  • LeftDown: the left mouse button was pressed
  • RightDown: the right mouse button was pressed
  • LeftUp: the left mouse button was released
  • RightUp: the right mouse button was released
  • LeftDoubleClick: the left mouse button was double clicked
  • RightDoubleClick: the right mouse button was double clicked
  • WheelMove: The mouse wheel has moved.

    The x and y parameters specify where the mouse is located. If the mouse has been grabbed (see captureMouse), the values of x and y can be negative if the mouse is outside the client area.

    The z parameter only applies to WheelMouse events and is the amount and direction that the wheel moved. Positive values mean it move away from the user (up), and negative values mean that it moved towards the user (down).

    The traps parameter is a list of one or more mousetrap areas that are under the mouse pointer. Each mousetrap is a sequence of 8 elements:

  • integer: zorder, the higher numbers are further in the background. The initial value is zero when a mousetrap is created.
  • integer: left, the leftmost position of the mousetrap area
  • integer: top, the topmost position of the mousetrap area
  • integer: right, the rightmost position of the mousetrap area
  • integer: bottom, the bottommost position of the mousetrap area
  • integer: id, the id of this mousetrap area.
  • object: userdata, the data set by calling setTagMouseTrap(). This is never used by win32lib and is intended for use by the user for anything.
  • sequence: filters, a list of zero or more mouse event codes that are used to filter in this mousetrap. Initially this set to {WM_LBUTTONDOWN} when then mousetrap is created. It can be changed by calling filterMouseTrap().

    The id parameter is the control id that received the mouse event.

    Note: This event is only invoked for MouseTraps that are enabled. When a mousetrap is created it is automatically enabled, but this can be changed by calling enableMouseTrap().

    sequence mt
    mt = {}
     mt &= createMouseTrap(vWin, {10,10,30,30})
     mt &= createMouseTrap(vWin, {30,10,50,30})
     mt &= createMouseTrap(vWin, {10,30,30,50})
     mt &= createMouseTrap(vWin, {30,30,50,50})
     filterMouseTrap(vWin, mt[2], {WheelMove})
     filterMouseTrap(vWin, mt[4], {WheelMove})
    

    procedure MouseTrap_MyWindow(integer self, integer event, sequence parms) sequence lMsg

    lMsg = sprintf("event=%d x=%d y=%d", parms[1..3]) for i = 1 to length(parms[4]) do lMsg &= sprintf("(depth=%d left=%d top=%d right=%d bottom=%d id=%d) ", parms[4][i]) end for showMessage(lMsg) -- Only interested in the top mousetrap area... if parms[4][1][6] = mt[2] then -- Wheel moved inside mousetrap #2 elsif parms[4][1][6] = mt[1] then -- Left Button down inside mousetrap #1 end if end procedure setHandler(vWin, w32HMouseTrap, routine_id("MouseTrap_BasicWindow"))

    If the hander for the w32HMouseTrap event returns any value, by calling returnValue(), the mouse event is not passed through to the underlying control.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HNotify

    A control is forwarding a notification event.

    Category: Events

    parms = { integer sender, integer event, object userdata, sequence parms }

    A control gets this event when the sender control has just processed an event of type event with parameters parms. This only happens to controls that have told the sender that they want to be notified via the registerNotification() routine. The userdata is the same as that passed in the registerNotification() routine.

    An example of using this facility could be if you wish a control to be notified whenever its parent is resized. Or when a specific control gets focus.

    Note: This event is not supported by the onXXX interface.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HOpen

    A Window is opened.

    Category: Events

    parms = {}

    This is typically triggered by WinMain, or openWindow, before the window is visible by the user.

    Typically, code that is run at this point does some sort of initialization.

    This event is only triggered for a Window.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HPaint

    A portion or all of a Window needs to be redrawn.

    Category: Events

    parms = {atom x1, atom y1, atom x2, atom y2}

    The parameters indicate the portion of the window that needs to be updated.

    Not only does {x1,y1,x2,y2} define the area that needs to be redrawn, Windows restricts your application to only being able to draw in those areas! If your application tries to write outside this rectangle on an paint event, nothing will be drawn there.

    Since Windows expects you application to be able to redraw any part of the application's window when responding to an paint event, this means that the paint routine must know how to render any part of the window.

    For programs without any graphics and text drawn on the window, there is no problem - since there are no graphics, there is nothing to update.

    If the application is fairly lightweight (such as a tic-tac-toe game), you simply choose to ignore the parameters passed to your paint handler, and redraw the entire window with each paint event.

    If there is sufficient graphics to make the task of repainting the window complex, the best approach is probably to do double-buffering with a Pixmap.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPause, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HPause

    Invoked whenever the Pause key is pressed.

    Category: Events

    parms = {integer keyCode, integer shift}

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HResize, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HResize

    A Window has been resized.

    Category: Events

    parms = { integer style, integer x, integer y}

    The style is one of the following:

  • SIZE_RESTORED: Window was restored
  • SIZE_MINIMIZED: Window was minimized
  • SIZE_MAXIMIZED: Window was maximized

    The x and y parameters are the new size of the id.

    If your handler returns a value via returnValue() then the control is forced to be repainted. If it returns a zero (0) then the control's background is not erased before repainting otherwise it is erased first.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HScroll, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HScroll

    Triggered when scrollbar value has changed, and when user has stopped scrolling.

    Category: Events

    parms = { integer position, integer ScrollType, integer WhichBar }

    position indicates the new value of a scrollbar or trackbar.

    ScrollType is one of...

    WhichBar is one of...

    and only applies to the Window control type.

    Note: However, the ScrollType and WhichBar are only available when using the setHandler() interface.

    This event is only triggered for ...

    ---------------------------------------------------------------------------

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HTimer, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [const]
    w32HTimer

    A timer is triggered.

    Category: Events

    parms = {atom TimerID}

    Timers are clocks that are maintained by Windows, and they trigger these events at a user-specified interval, measured in milliseconds.

    They are created and removed with the calls:

  • setTimer( window, TimerID, milliseconds )
  • killTimer( window, TimerID )

    A timer is not treated as an actual control. Rather, the event is sent to the window that the timer is associated with.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32Start


    Documentation for Win32lib v0.60.6
    Table of Contents

    [incl]
    w32Start
    (w32start.ew)

    This is an optional include file. It defines a default application callback routine

    Category: Events

    and uses startApp() with the application-defined "AppCallback" as the application's callback routine, and the application-defined "main" routine as the application's start up routine.

    See Also: AppCallback, closeApp, doEvents, getHandler, getLastMsg, getReturnValue, invokeHandler, main, onXXX, removeHandler, resetReturnValue, returnValue, setCallback, setDefaultProcessing, setEventLoop, setHandler, setIdle, setMouseClick, setNotifyHandler, setWinMsgHandler, startApp, subClassControl, w32HActivate, w32HAfterEvent, w32HBreak, w32HChange, w32HClick, w32HClose, w32HCloseUp, w32HDataChange, w32HDestroy, w32HDragAndDrop, w32HDropDown, w32HEvent, w32HGotFocus, w32HIdle, w32HKeyDown, w32HKeyPress, w32HKeyUp, w32HLostFocus, w32HMouse, w32HMouseTrap, w32HNotify, w32HOpen, w32HPaint, w32HPause, w32HResize, w32HScroll, w32HTimer