[comp.sys.amiga.tech] Gadget Mutual-Exclude

labben@iesd.auc.dk (Lars Bodin) (10/30/90)

Does anyone out there in NetLand know how to use Mutual-Exclusion between
gadgets? If so, could you please send me some info on how to do it,
or even better - a C-source showing what to do.

Thanks in advance.

myb100@csc.anu.oz.au (10/31/90)

In article <1990Oct30.071911.5122@iesd.auc.dk>, labben@iesd.auc.dk (Lars Bodin) writes:
> Does anyone out there in NetLand know how to use Mutual-Exclusion between
> gadgets? If so, could you please send me some info on how to do it,
> or even better - a C-source showing what to do.
> 
> Thanks in advance.

Free-Plug time: Have a look at the C-Manual by Anders Bjerin, on FF337. 
It's an excellent guide for people just starting to look at programming
the Amiga (and who are too nervous to look at the RKMs yet :-) ) Plenty
of example code too ! Great effort Anders ! Thanks heaps !!!

Having said that, Anders doesn't give an example of Mutual-Exclude usage, but
does describe it in Chapter 4 'Gadgets'. Briefly: You know where the
Mutual-Exclude field is in the gadget structure ? (just after the GadgetText)
Usually it's set to NULL. To use it, set it the following way:
(paraphrasing the discussion from the Cmanual (without permission))

The decimal number that goes here indicates which gadgets (of the first 32 in
the list) are to be mutually excluded when this one is selected. Let's
say you want to de-select gadgets 0, 2, 5 and 8 when this one is selected.
Write this as 100100101 (read from right to left, starting with gadget#0)
This is = (dec) 293 - and this goes into the mutual-exclude field.
Simple really ! :-) Note that mutual-exclude only works with TOGGLESELECT 
gadgets though.

Hmmm - What do you do though if you have more than 32 gadgets ???
Can anybody answer that one ?

===============================================================================
 Markus Buchhorn                                           ///  | This space
 Mt Stromlo and Siding Spring Observatories, Canberra     ///   | 
 PMB Weston Ck. P.O. A.C.T. 2611, Australia           \\\///    | intentionally
 markus@mso.anu.oz.au  -or-  nssdca::psi%mssso::markus \XX/     | left blank
===============================================================================

peter@cbmvax.commodore.com (Peter Cherna) (11/02/90)

In article <ggk.657326972@tirith.UUCP> ggk@tirith.UUCP (Gregory Kritsch) writes:
>myb100@csc.anu.oz.au writes:
>Actually, the cute part of the whole thing is the fact that gadget
>mutual exclusion doesn't work, unless you code it youself.  Further,
>Commodore's definition of it was that it would DISABLE, not deselect,
>the listed gadgets.

Gadget mutual exclusion is indeed not supported through the original
defined interface.  It wouldn't have worked very well that way.
Under 2.0, the Gadget Toolkit implements easy mutual exclusion,
and the new custom gadget stuff makes mutual exclusion much easier.

>Basically, what I've always done is to self-code the exclusion algorithm
>for both en/disabling gadgets and (de)selecting them into my GADGETUP
>code.

There are several restrictions you have to follow to do mutual exclusion
correctly.  See the AmigaMail article and the 1.3 ROM Kernel Manual
for full details.  One restriction is that you MUST use GADGIMMEDIATE
(not RELVERIFY) gadgets, and do your selection changes upon receiving
GADGETDOWN (not GADGETUP) messages.  You should use gadgets whose
imagery is an Image (GADGIMAGE) and is highlighted with another
image (GADGHIMAGE) or by complementing (GADGHCOMP).  You cannot
use things like gadgets whose imagery is a Border plus IntuiText
having GADGHCOMP highlighting.

>  Gregory Kritsch                          | University of Waterloo


     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.cbm.commodore.com
My opinions do not necessarily represent the opinions of my employer.
"She read him like a book:  she liked to peek at his end."

eeh@public.BTR.COM (Eduardo E. Horvath eeh@btr.com) (11/02/90)

	So does a new version of the OS really support mutual-exclude gadgets?
My RKMv1.1 says about the MutualExclude field: "Currently, Intuition ignores
this field."  Has this changed?


=========================================================================
Eduardo Horvath				eeh@btr.com
					..!{decwrl,mips,fernwood}!btr!eeh
	"Trust me, I know what I'm doing." - Sledge Hammer
=========================================================================

ernie@aquarium.buffalo.ny.us (Ernest J. Gainey III) (11/02/90)

In article <ggk.657326972@tirith.UUCP>, Gregory Kritsch writes:

> myb100@csc.anu.oz.au writes:
> >Hmmm - What do you do though if you have more than 32 gadgets ???
> >Can anybody answer that one ?
>
> Actually, the cute part of the whole thing is the fact that gadget
> mutual exclusion doesn't work, unless you code it youself.  Further,
> Commodore's definition of it was that it would DISABLE, not deselect,
> the listed gadgets.
>
> Basically, what I've always done is to self-code the exclusion algorithm
> for both en/disabling gadgets and (de)selecting them into my GADGETUP
> code.
>

 to answer the original question as presented here,

  yes you can have more than 32 gadgets.. i have over 80.

 (yup, i said 80!)  . ..

  i also think that the lack of system code for mutual exclude is a bit
   lax on commodores part.. also check out what happens when you ghost
   a gadget that is just plain IntuiText.. when you re-activate it,
  intuition doesn't remember to remove the ghost pattern!

 (ugh!)

  hope this helps in some way!


Ernest J. Gainey III   Home: ernie@aquarium.buffalo.ny.us       //\\
 The Amiga Aquarium  School:  gainey03@snybufva.bitnet         //==\\
  +1 716 837-1699    Snail :440 Berkshire, Buffalo, NY 14215\\//    \\miga!

labben@iesd.auc.dk (Lars Bodin) (11/02/90)

>Does anyone out there in NetLand know how to use Mutual-Exclusion between
>gadgets? If so, could you please send me some info on how to do it,
>or even better - a C-source showing what to do.
>
>Thanks in advance.

Thanks to all who responded.

Since intuition doesn't support the mutual-exclusion between gadgets
under KickStart 1.3, I will now try to program something myself which takes
care of the selection/deselection of the gadgets.

With the guidelines from Peter Cherna, it shouldn't be to hard to program it
(I have looked at your sample source, Peter. Look's fine. I will have this in
mind, when I program my own stuff)

Well, thanks again folks. It is nice to see how helpfull all you Amiga-guru's
are.


                                       Lars Bodin

peter@cbmvax.commodore.com (Peter Cherna) (11/03/90)

In article <868@public.BTR.COM> eeh@public.BTR.COM (Eduardo E. Horvath  eeh@btr.com) writes:
>
>	So does a new version of the OS really support mutual-exclude gadgets?
>My RKMv1.1 says about the MutualExclude field: "Currently, Intuition ignores
>this field."  Has this changed?

Intuition still ignores this field, upto and including 2.0.

The Gadget Toolkit in the 2.0 Kickstart provides easy mutual exclusion.

2.0 Intuition has object-oriented custom gadgets, which can readily
support mutual exclusion much better than the MutualExclude field
could ever have.


>Eduardo Horvath				eeh@btr.com

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.cbm.commodore.com
My opinions do not necessarily represent the opinions of my employer.
"She read him like a book:  she liked to peek at his end."

ggk@tirith.UUCP (Gregory Kritsch) (10/31/20)

myb100@csc.anu.oz.au writes:
>Hmmm - What do you do though if you have more than 32 gadgets ???
>Can anybody answer that one ?

Actually, the cute part of the whole thing is the fact that gadget
mutual exclusion doesn't work, unless you code it youself.  Further,
Commodore's definition of it was that it would DISABLE, not deselect,
the listed gadgets.

Basically, what I've always done is to self-code the exclusion algorithm
for both en/disabling gadgets and (de)selecting them into my GADGETUP
code.

>===============================================================================
> Markus Buchhorn                                           ///  | This space
> Mt Stromlo and Siding Spring Observatories, Canberra     ///   | 
> PMB Weston Ck. P.O. A.C.T. 2611, Australia           \\\///    | intentionally
> markus@mso.anu.oz.au  -or-  nssdca::psi%mssso::markus \XX/     | left blank
>===============================================================================
--
  Gregory Kritsch                          | University of Waterloo
    Fido:  1:221/208.11110  [1:163/109.30] | 1A Computer Engineering
    UUCP:  ggk@tirith.UUCP                 |--------------------------
           ...!watmath!xenitec!tirith!ggk  | Amiga Fanatic