Copyright (c) Hyperion Entertainment and contributors.

AmiWest 2013 Lesson 3

From AmigaOS Documentation Wiki
Jump to navigation Jump to search

ProcTree Redux

At AmiWest 2012 we took a look at a simple application which presented a graphical tree of all the Processes running on your Amiga. I don't believe we spent enough time exploring this example which is what this lesson will focus on.

Full source code is available from here.

Setup

The ProcTree example uses many Amiga-only features to setup the application including:

  1. Embedded version string
  2. Stack cookie
  3. stdio window control
  4. Startup from Shell and Workbench
  5. C library provided interfaces

main()

For an application you generally want to keep main() simple and to the point. This enables easier cleanup when errors occur because you only have a limited number of function calls to clean up after during a failure.

handle_gui()

This function handles the GUI overall. It will open the various BOOPSI classes and set up the global pointers. It must always clean up whatever resources are allocated as well.

handle_gui_window()

The purpose of this function is to handle the GUI window.


Working with AmigaOS GUIs can be quite challenging. There are several toolkits available including the original Intuition, GadTools, basic BOOPSI, ReAction and MUI. Although all toolkits are still available, new applications should use either ReAction or MUI for best results.

This tutorial will focus on using ReAction to create a simple GUI. The GUI displays and automatically updates the system Process tree. This simple example touches on many aspects of AmigaOS programming.

Topics explored include:

  • Opening/Closing BOOPSI classes correctly
  • BOOPSI class interfaces
  • MEMF_PRIVATE data
  • Exec lists
  • ReAction GUIs using window.class
  • Deferred GUI refreshing
  • Hierarchical listbrowser
  • BOOPSI object user data fields
  • Process break signals
  • Process list change notification
  • Listbrowser labels detachment and reattachment
  • Refreshing a BOOPSI object
  • Process IDs
  • Exec objects (LIST, HOOK, NODE)
  • Proper GUI cleanup and exit