Gadget Toolkit Example Code

1991 Amiga Developers Conference, Milan.

There are five example programs, each of which may be compiled with

	lc -L

or

	lc -L -cfist -v


menu1.c:

This is an example of using GadTools menus.  It creates a menu strip
that has two menus, with several items each.  Sub-menus and separator
bars are also shown.  This program prints out information regarding
any menu activity.  If run with no parameters, menu1 will use the
screen's font to layout the menus.  Optionally, menu1 takes a font
name and size as parameters, and it will lay the menus out using the
font you specify if it is available.  You might say

	menu1 times.font 24


gadget1.c:

This is a straightforward example of creating GadTools gadgets.  It
creates a string gadget, a slider gadget, and a button gadget.  The
program prints out descriptions of the gadget activity it sees.  As
well, clicking on the button increments the slider by one, until it
wraps back around.


gadget1b.c:

This incarnation adds two more string gadgets, so you can play with
the Tab and Shift-Tab features.  As well, keyboard support has been
added for the gadgets.


gadget2.c:

This is an example of how one might do font-sensitive gadget layout
using GadTools.  This program prints out information regarding any
gadget activity.  If run with no parameters, gadget2 will use the
screen's font to layout its gadgets.  Gadget2 optionally takes a font
name and size as parameters, and it will lay its gadgets out using
the font you specify if it can find it.  You might say

	gadget2 helvetica.font 15


gadtools1.c:

This is a fairly involved example of GadTools gadgets and menus, and
interactions between them.  It demonstrates the twelve specific kinds
of GadTools gadgets, as well as many of the features of menus.

The following is a list of the interactions:

The "Gadgets" menu has an item "Foo" with sub-items "Set", "Clear",
and "Toggle".  These will set, clear, or toggle the checkbox gadget
labelled "Foo".

The "Gadgets" menu has a "Slider" item with sub-items "Increase" and
"Decrease".  Selecting these will increment or decrement the slider
gadget by 1, 5, or 10, which is also selectable by menu.

Clicking on the "ClickMe" button will change the contents of the
integer gadget to the number "271828".

If the "Gadgets/MX Gadgets/Connected" sub-menu item is checked, then
selecting Monday through Sunday from the mutually exclusive gadgets
will set the cycle gadget to January through July respectively.
Likewise, setting the cycle gadget to one of the first seven months
will change the selected mutually exclusive gadget to the
corresponding day.

If you drag the slider to a level between 0 and 11, the currently
selected item in the listview will be set to the item of that number.
