cjp@antique.UUCP (Charles Poirier) (11/20/87)
I need some help using Intuition's Boolean Gadgets. I'm using V1.2. These are basically rendering problems. Case one: Boolean gadgets, in a window (not a requester), GADGHCOMP, TOGGLESELECT | RELVERIFY, NULL GadgetRender, and GadgetText using the default font. For this case, I am not using GADGDISABLED. I find that, after installing these gadgets, I can't erase them. I do RemoveGadget() for all of them, followed by one RefreshGadgets(). Neither the IntuiText, nor the complemented box (for the selected gadgets) is erased. I could perhaps understand the text remaining, as it is documented as "printed after the gadget is rendered". I'd be willing to re-draw the text in the background pen before removing, if necessary. But shouldn't RemoveGadget at least re-flip the HCOMP box? It kind of looks like RemoveGadget does nothing but unlink it from the window, which if true, is a bit disappointing. Case two: Again, Window, Boolean Gadgets, null GadgetRender, with IntuiText, but now GADGHBOX | GADGDISABLED and RELVERIFY without toggleselect. The Gadgets come up ghosted as they should. But when I try to enable the gadgets, the ghosting remains. They do become enabled, i.e. selectable; the outline box comes on while select-down is held, as expected; but the ghosting seems stuck on. I tried OnGadget, tried following it with RefreshGadgets; tried gad->Flags &= ~GADGDISABLED then RefreshGadgets; tried RemoveGadget then gad->Flags &= ~GADGDISABLED then AddGadget then RefreshGadgets. Tried substituting RefreshGList for RefreshGadgets in some of the above cases. Still ghosted. None of these match my reading of the documented behavior of OnGadget: "When a Gadget is enabled, ... its imagery is displayed normally (not ghosted)." Is there some weird problem due to having IText but no GadgetRender? In case it matters, my screen is SCREENQUIET, my window idcmp is MOUSEBUTTONS | GADGETUP, the window is RMBTRAP | SMART_REFRESH | BORDERLESS. I guess Requester Gadgets would probably erase cleanly by ending the requester, but at least for the unghosting problem, requesters shouldn't be necessary, should they? Also, I'm concerned about having to "satisfy" requesters in the reverse order of invoking them. Is this a requirement even with NOISYREQ requesters? I want to be able to add and subtract gadgets at will. Some I want to just disable/enable, but some I want to be completely removed and erased. They must be essentially random-access for the user and the program. I'd prefer to avoid having to fake up my own brand of gadgets using Bobs, paperclips, and rubber bands. So please: Is there an Intuition function to erase a Gadget? And how do I accomplish Gadget unghosting during the current Phase of the Moon? Thank you. Charles Poirier (ihnp4, ucbvax)!vax135!cjp
cmcmanis%pepper@Sun.COM (Chuck McManis) (11/23/87)
Yes, BOOLEAN gadgets with nothing but IntuiText and Border structures
have serious problems under intuition. The only truely useful BOOLEAN
gadget is one with Imagery. So the workaround/answer is to build a
little baby bitmap and render your intuitext/border into it, and then
munge it into an Image structure and pass that to intuition. Also
On/OffGadget does not work as you might expect and can cause flashing
of your Boolean gadgets. It is better (and certainly more efficient)
to set or reset the GADGDISABLED flag and then call RefreshGList()
with only that gadget. With neither an Image or Border struct some
of Intuitions routines my get confused into believing that this is
an Invisible gadget and thus the lack of response from OnGadget().
As for removing gadgets from the screen, no support at all. AddGadget()
and RemoveGadget() simply manipulate the Window's gadget list. You can
write one though really easily, it goes something like :
void
EraseGadget(w,g)
struct Window *w;
struct Gadget *g;
{
SetAPen(w->RastPort,w->BgPen);
RectFill(w->RastPort,g->LeftEdge,g->TopEdge,
g->LeftEdge+g->Width,g->TopEdge+g->Height);
}
Or you could pass in a color you wanted to use instead of the windows
background pen.
--Chuck McManis
uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.