Blitz:GadTools
GadTools is an updated system of gadgets that was introduced in OS 2.0, and is supported in all versions from 2.0 on. It offers some large improvements over the standard Intuition gadgets and is the standard, familiar look from OS 2.0 to 3.1. It is quite low level meaning, and it lacks some more advanced features from the more modern toolkits such as MUI, but has a very low footprint and doesn't need any external toolkits installed to work.
Contents
How to Use GadTools
GadTools gadgets are defined using a unique ID to identify each object, and a GTList object number to which the gadgets belong. All gadgets require you to specify the size and position of the gadget. Once the gadgets are defined, the GTList containing them can be attached to a standard Intuition window for use. Only one GTList can be attached to a window at any one time, and a GTList can only be attached to one window at any one time. Once attached, the gadgets will trigger standard IDCMP events when used.
Defining GadTools Objects
GadTools objects are defined using straightforward commands for each gadget type. The specifics of each command vary from gadget to gadget, but many parameters are the same.
Buttons
Buttons are set up using the GTButton command with the form:
GTButton GTList, id, X, Y, W, H, Text$, flags
Where GTList is the ID of the GTList to which the button will belong, id is the unique ID of the new button, X and Y are the co-ordinates of the top left corner of the gadget relative to the top left corner of the window. W and H are the width and height of the gadget in pixels. Text$ is the actual text to put in the button, and flags is a flag value based on the required values from the GT flags listed above. An example of use:
GTButton #maingtlist, #continuebutton, 20, 20, 100, 20, "Continue", #PLACETEXT_IN
The flag #PLACETEXT_IN is normal for a button since normally the text is in the middle of the button.
Attaching GadTools to Your Window
When you open a standard window, you can attach your gadgets to the window using the AttachGTList command. This command takes the ID of the GTList object and the ID of the window. Once complete, the gadgets will be drawn at their relevant locations and will be ready to use. For example:
AttachGTList #maingtlist, #mainwindow