Section 14 Home page Section 16

15. Selected Events of TOS 4.0+

So far, we have kept our treatment of GEM programming at a level which would suit all Atari GEM platforms, from the Atari ST running TOS 1.04 to powerful clones such as the Firebee running Mint/XaAES. The later versions of AES do, however, support additional events and features which are worth including in your programs, if you wish them to run on the more powerful systems.

This list is a very incomplete summary of some events I have started including in my GEM programs:

  1. Shading: Shading is where the window is collapsed into its title bar. On Mint/XaAES this is achieved by right- or double-clicking the title bar. When shaded, windows should not redraw themselves or respond to keyboard events. One way to handle this is to:

    • include a flag shaded in win_data

    • set this flag to true when receiving the message WM_SHADED

    • set this flag to false when receiving the message WM_UNSHADED

    • in draw_interior, simply return if wd→shaded is true, before drawing anything

  2. AP_TERM: this message is sent to tell your application to quit. You can handle this in the event loop, by checking that msg_buf[3] != AP_TERM in the condition of the do-while loop.

  3. WM_ONTOP: If another window is closed which leaves your window on top, this message is sent to your application. This is useful in circumstances when you want to update some displayed information based on the current top window. (Sokoban uses this to enable or update checks on menu items for the current top window.)

  4. WM_BOTTOMED: A single click on the window title in Mint/XaAES sends the window back in the window list. To support this, include the following code in event loop, within the switch statement of message types:

case WM_BOTTOMED:
        wind_set (msg_buf[3], WF_BOTTOM, 0, 0, 0, 0); // <1>
        break;
  1. Set the given window handle to the bottom.