[comp.sys.amiga.tech] Refreshing Gadgets

collins@pnet02.cts.com (Steven Collins) (06/03/89)

When I try to refresh my list of gadgets using RefreshGList,
any boolean gadgets that are currently selected (and therefore highlighted...)
are complemented and therefore seem to change state. I would like to 
be able to have my program change the state (and text) of these
gadgets and then display their current state correctly. How does one
do this? 
                              Thanks, Steve Collins
                              backbone!gryphon!pnet02

UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!collins
INET: collins@pnet02.cts.com

cmcmanis%pepper@Sun.COM (Chuck McManis) (06/05/89)

In article <16390@gryphon.COM> collins@pnet02.cts.com (Steven Collins) writes:
>When I try to refresh my list of gadgets using RefreshGList,
>any boolean gadgets that are currently selected (and therefore highlighted...)
>are complemented and therefore seem to change state.

Well they shouldn't "change state" they should already be in that state. 
When you call RefreshGList() Intuition looks at the SELECTED bit, and the 
highlight mode, and then "renders" is appropriately. One way of doing 
homemade Mutual Exclude is to track down the excluded but still selected
gadget RemoveGadget() it, reset the selected bit, AddGadget() it back in
and then RefreshGlist() it to have it displayed in the appropriate rendering
style.

But there is a caveat. Do not ever try to use Boolean gadgets with IntuiText
as part of the gadget. The reason is that Intuition doesn't know to refresh
these correctly and will only get it right one time out of 4. This is a known
deficiency of boolean gadgets. If you want correctly functioning boolgads the
only really foolproof way to do it is with a pair of images. 


> I would like to 
>be able to have my program change the state (and text) of these
>gadgets and then display their current state correctly. How does one
>do this? 

Since you mention text, I think you may have hit this bug. When I build
boolean gadgets with several kinds of text (buttons) I usually render them
into a bunch of little bitmaps and stick those in the gadgets.


--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.
"A most excellent barbarian ... Genghis Kahn!"

asaph@TAURUS.BITNET (06/05/89)

In article <16390@gryphon.COM> collins@pnet02.cts.com (Steven Collins) writes:
>When I try to refresh my list of gadgets using RefreshGList,
>any boolean gadgets that are currently selected (and therefore highlighted...)
>are complemented and therefore seem to change state. I would like to

This same thing happened to me, and I could find no work-around. I ended up
using the feature/bug to do mutual-exclusion :
    RefreshGadgets  turns off highlighted boolean GADGHCOMP gadgets
    SetNewStates    more on this follows
    RefreshGadgets  turns on only newly set gadgets

As for set-new-states : the documented method (Remove, play around, Add) worked
only on Gadgets in windows, It gurued for those in requesters. The only way
I found to play with these gadgets was to change their Selected bits directly
without removing them. Since I didn't know how safe this was I surrounded that
bit with Forbid/Permit. - Icky!

Comments & Constructive critisism welcomed.

>be able to have my program change the state (and text) of these
>gadgets and then display their current state correctly. How does one
>do this?
>                              Thanks, Steve Collins
>                              backbone!gryphon!pnet02
>
>UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!collins
>INET: collins@pnet02.cts.com

                                Asaph.
asaph@taurus.bitnet
asaph@math.tau.ac.il