[comp.sys.amiga.tech] Ghosting of Boolean Gadgets

blubaugh@ucqais.uc.edu (Dwight Blubaugh) (01/11/89)

I'm having problems with Boolean gadgets that I hope someone could explain.
I'm trying to use OnGadget/OffGadget to activate/deactivate the gadget as
needed.  The gadget in question is a very simple bordered boolean gadget.
When GADGDISABLED flag is set before AddGadget or set using OffGadget the
entire hitbox area is properly ghosted. However, when OnGadget is used to
reactivate the gadget the ghosting remains, except around any text in gadget.
This behaviour is the same in 1.2 or 1.3 WB, but is this normal?  
The RKM, autodocs, and everybody else says that OnGadget will redraw gadget
not ghosted.  Do I have to erase the hitbox area myself and then refresh the
gadget after the OnGadget?


-- 
president of Ohio Valley Amiga Users Group (Cincinnati Ohio P.O. Box 428539)
It's good to be king! 
UUCP: {decuac,mit-eddie,phri,pyramid}!uccba!ucqais!blubaugh
USMAIL: Dept of Chemistry ML172, University of Cincinnati, Cincinnati OH 45221

cmcmanis%pepper@Sun.COM (Chuck McManis) (01/13/89)

In article <1568@ucqais.uc.edu> blubaugh@ucqais.uc.edu (Dwight Blubaugh) writes:
>I'm having problems with Boolean gadgets that I hope someone could explain.
> ... The gadget in question is a very simple bordered boolean gadget.

That is the problem. One would think that the simplest boolean gadget in
the world would be a gadget consisting of nothing more than a border and
and IntuiText structure. However that just ain't so. The interactions
between the draw modes of the border and the text and interesting as are
the kinds of assumptions intuition makes about the state of the world
before it draws stuff. The easiest way to make those gadgets work is
to Alloc a little bitmap, render your text and border into it, and then
build a gadget out of it that is an Image gadget (which it turns out is
really the simplest gadget). Then things will work as you expect except
that you will probably get a lot of "flashing" when you refresh your
gadgets. I think the trick here is to never use the SELECTED flag but
I may be wrong.


--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.

shf@well.UUCP (Stuart H. Ferguson) (01/13/89)

+-- blubaugh@ucqais.uc.edu (Dwight Blubaugh) writes:
| I'm trying to use OnGadget/OffGadget to activate/deactivate the gadget as
| needed.  The gadget in question is a very simple bordered boolean gadget.
| .... However, when OnGadget is used to
| reactivate the gadget the ghosting remains, except around any text in gadget.
| ... is this normal? 

'Fraid so.  Intuition appears to just "Refresh" the gadget in question,
which in your case will just redraw the border and text.  If you use JAM2
mode on the text, it will erase any stipple just around the letters, but
that's all. 

| Do I have to erase the hitbox area myself and then refresh the
| gadget after the OnGadget?

'Fraid so.  As far as I can tell anyway.  Another way is to make the 
Gadget imagery an actual Image.  Then the refresh will erase the old
one completely.  Kind of overkill for simple gadgets, however.
-- 
		Stuart Ferguson		(shf@well.UUCP)
		Action by HAVOC

billk@pnet01.cts.com (Bill W. Kelly) (01/13/89)

Chuck McManis was saying:
>... The easiest way to make those gadgets work is 
>to Alloc a little bitmap, render your text and border into it, and then
>build a gadget out of it that is an Image gadget (which it turns out is
>really the simplest gadget). Then things will work as you expect except
>that you will probably get a lot of "flashing" when you refresh your
>...

I have a way of doing it that accomplishes the same thing without having
to allocate CHIP RAM for Image data and render the text and border into it.

I use two linked image structures and NO image data.  I also use the 
gg_GadgetText field to do the text.

                        1111111111111111111111111
                        1                       1
                        1  2222222222222222222  1
                        1  2                 2  1
                        1  2    GadgetText   2  1
                        1  2                 2  1
                        1  2222222222222222222  1
                        1                       1
                        1111111111111111111111111

The ones represent the rectangle covered by the first image.
The twos represent the rectangle covered by the second image.

The second image is linked to the first image through the first image's
ig_NextImage pointer.

I use the ig_PlaneOnOff bits to pick the color I want each image to be
drawn with.    Suppose I set the first (outer) image so that it will
produce a big black rectangle when drawn, and the second (inner) image
so that it will produce a big white rectangle a few pixels smaller than
the black rectangle.  Now you've got a white gadget (the big white rectangle)
surrounded by a black border (what's left of the black rectangle).  
Finally, Intuition will render the GadgetText.

Interestingly enough, this method hardly "flashes" at all!  I use it quite
often and for some very *BIG* gadgets (2 bitplane screen).  The only
detectable flashes are on the largest gadget (about 500 pixels wide by 40
pixels high).

Another effect that I get out of this is to make another set of image 
structures that I put in the gg_SelectRender field.  I make the SelectRender
images smaller than the normal images so that when you click on the gadget,
it animates.  (The "border" shrinks in towards the gadget text.)

Even animating the images that way hardly causes any "flashing."
(Blitters are wonderful, aren't they?)

By the way, it's possible I may have meant ig_PlanePick instead of
ig_PlaneOnOff.   I don't remember.  Whatever it's name is, it's the one
that selects image planes that will be turned on or off (probably PlaneOnOff,
huh? :-) without having to have any image data for said planes.

This method seems to work quite well for me.
--
NAME: Bill W. Kelly
UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!billk
ARPA: crash!pnet01!billk@nosc.mil
INET: billk@pnet01.cts.com

"main() {printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}"
                                            -- David Korn, AT&T Bell Labs