home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
432b.lha
/
EzLib
/
doc
/
create_boolgadget.doc
< prev
next >
Wrap
Text File
|
1990-11-10
|
2KB
|
53 lines
FUNCTION create_boolgadget() - create a fully spec'ed Boolean gadget
struct Gadget *create_boolgadget(l_edge, t_edge, flags, activation, text, id)
SHORT l_edge, t_edge;
USHORT flags, activation;
UBYTE *text;
USHORT id;
This function gives you total control for easily creating boxed boolean
gadgets of all types. You specify exactly the flags and activation types
of the gadget and where the top corner should be, and the rest is taken
care of. The text you specify is centered in the gadget and the gadget has
the ID you give.
You can specify any types of flags you would like, however not much
error checking is done on these values. Be careful for silly combinations.
You should also remember that you MUST specify either GADGHBOX or GADGHCOMP
for the flags argument. It is also useful to at minimum specify RELVERIFY
for the Activation argument. Finally, you should make sure that your
window is listening for Gadget messages (either gadget UP or gadget DOWN).
This function will NOT add the gadget to your window. This is
something you must do afterwards else you will never see your gadget. The
only thing this function does is to allocate space and return a pointer to
the properly filled out structure.
The following example will create a boolean gadget at 100,25
which is highlighted by a box. The text inside the gadget will be
"Don't have a cow dude" and the gadget will have an id of 42.
struct Window *win; /* assume opened earlier */
struct Gadget *gadg;
char *string = "Don't have a cow dude";
gadg = create_boolgadget(100,25, GADGHBOX, RELVERIFY, string, 42);
if (gadg == NULL)
error_no_gadg();
/* add it to the window and make it appear */
AddGadget(gadg, win, NULL);
RefreshGList(gadg, win, NULL, 1);
TODO : should provide a way for specifying custom imagery. Most likely
that will have to be a seperate call.
BUGS : maybe, maybe not (preferably the latter).
SEE ALSO : makeboolgadget(), killgadget(), getyn(), getstring(),
makewindow()