Using the C API the application has the opportunity to join a void pointer to a callback at registering time. This pointer is supplied back to the callback as the third argument in the callback call.
Object events are: mouse and keyboard input, window expose and resize, or internally generated events such as 'text change', 'color change' or 'shadow change'.
Unlike many high level programming environments (like OSF/Motif or Windows) which require a system window for each Object, MGUI requires only a system window for each individual top-level window, whatever complex is the Object hierarchy.
System events are received by the library in each window owned by the MGUI application, despatched to the 'SHELL' Object (the only one bound to the system window) and then received by the destination Object via the object hierarchy.
Mouse events are normally despatched to the Object below the mouse pointer. Once an Object has received a 'mouse button press' event, it can 'grab' the mouse so it can receive all mouse events including the 'button release', even if the mouse is over another Object.
Keyboard events are reported by the system to the top-level window that owns the 'input focus'. This window is normally highlighted with a different color in the title bar.
When a MGUI top-level window receives the input focus, there is a single destination Object that can really process keyboard events and it is highlighted with a thin black border to indicate it. Input focus is shifted to other Objects by explicit user selection with the mouse, by a MSelectObject() function call in the program, or by spontaneous Object grant (as a result to the user pressing on arrow or tab keys. Up and left arrow keys (if not processed by the Object) cause the input focus transfer to the previous 'brother' Object. Similarly, down and right arrow keys cause the focus to be transferred to the next brother Object. Tab and <Shift+Tab> transfer the input focus (if not processed) respectively to the next 'cousin' and the previous cousin.