home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
432b.lha
/
EzLib
/
doc
/
killgadget.doc
< prev
next >
Wrap
Text File
|
1990-11-10
|
1KB
|
39 lines
FUNCTION killgadget() - Remove and de-allocate a gadget
killgadget(win, gadg)
struct Window *win;
struct Gadget *gadg;
This function will remove a gadget from your window and de-allocate all
of its resources. After this call, gadg will be invalid and will no
longer appear in your window.
Unfortunately this call is not orthogonal to the rest of the kill()
functions, as it needs to know the window from whence it came (to be able
to make the gadget go away).
In case you would want to do this on your own, the memory that is freed
is as follows (in reverse order from how it was allocated) :
gadg->GadgetRender->XY : 10 * sizeof(SHORT)
gadg->GadgetRender : sizeof(struct Border)
gadg->IText : sizeof(struct IntuiText)
gadg : sizeof(struct Gadget)
You should make sure that any dynamically allocated text that may be in
your gadget is managed properly (by having a backup pointer or freeing it
before this call).
After this call, the specified gadget should no longer appear in your
window.
TODO : maybe not require the window pointer. could stuff the value in the
user data field, but then the user can't use that field.
BUGS : shouldn't be
SEE ALSO : makeboolgadet(), create_boolgadget(), getyn(), getstring()