[comp.sys.amiga.tech] Ask Mr. Intuition

kevin@uts.amdahl.com (Kevin Clague) (01/18/89)

[ I'm a line-eater and I'm O.K., I eat mail at night and I sleep all day ]

I'm having problems getting potentiometer gadgets to work the way I
would like.  Intuition provides GADGIMMEDIATE flags for GADGETDOWN
IDCMP events, FOLLOWMOUSE flag for MOUSEMOVE events, and
RELVERIFY for GADGETUP events.  The problem I have is that
RELVERIFY gadgets only provide GADGETUP events if the mouse is
over the gadget at the time of left mouse button release.
I would like to have a gadget flag that guarantees GADGETUP events
if you get a GADGETDOWN event.

I have an operation I would like to do everytime the user uses a
particular potentiometer gadget.  The operation is too time consuming
to do as the potentiometer is sliding, so I'd like to defer the
operation until the user let's go of the potentiometer gadget.
The results of the operation depend on the value of the slider
at the time of it's release.

Because of a RELVERIFY gadget's operation I can't be sure that
I'll get the GADGETUP event, and then can't perform the desired
operation.

In my application, it is as important to know that the user has
stopped using the gadget as it is that they started using it.

I can simulate my own slider using MOUSEBUTTONS and MOUSEMOVES, but
then I have to slide the knob and clear the container and all that
other stuff.

Is there some other flag tha I don't know about that will do what I
want?  If not then is it reasonable to add a new flag for 1.4?

Kevin
-- 
UUCP:  kevin@uts.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,seismo,oliveb}!amdahl!kevin
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

jesup@cbmvax.UUCP (Randell Jesup) (01/18/89)

In article <efCt2b0Yfv1010zgXWk@amdahl.uts.amdahl.com> kevin@uts.amdahl.com (Kevin Clague) writes:
>[ I'm a line-eater and I'm O.K., I eat mail at night and I sleep all day ]
>
>I'm having problems getting potentiometer gadgets to work the way I
>would like.  Intuition provides GADGIMMEDIATE flags for GADGETDOWN
>IDCMP events, FOLLOWMOUSE flag for MOUSEMOVE events, and
>RELVERIFY for GADGETUP events.  The problem I have is that
>RELVERIFY gadgets only provide GADGETUP events if the mouse is
>over the gadget at the time of left mouse button release.
>I would like to have a gadget flag that guarantees GADGETUP events
>if you get a GADGETDOWN event.

	Well, it doesn't exist at present.  You could turn on Intuiticks when
you get the gadgetdown, and look at the mousebutton qualifiers (I believe
they are valid).  Don't forget to turn them off when done.

>I have an operation I would like to do everytime the user uses a
>particular potentiometer gadget.  The operation is too time consuming
>to do as the potentiometer is sliding, so I'd like to defer the
>operation until the user let's go of the potentiometer gadget.
>The results of the operation depend on the value of the slider
>at the time of it's release.

	Prop gadgets appear to produce gadgetups with relverify, even if the
mouse is off the gadget.  Relverify really only applies to boolean gadgets
(in terms of the verify function).  Maybe jimm will expand on this.

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup

kevin@uts.amdahl.com (Kevin Clague) (01/19/89)

In article <5718@cbmvax.UUCP> jesup@cbmvax.UUCP (Randell Jesup) writes:
>In article <efCt2b0Yfv1010zgXWk@amdahl.uts.amdahl.com> kevin@uts.amdahl.com (Kevin Clague) writes:
>>
>>I'm having problems getting potentiometer gadgets to work the way I
>>would like.  Intuition provides GADGIMMEDIATE flags for GADGETDOWN
>>IDCMP events, FOLLOWMOUSE flag for MOUSEMOVE events, and
>>RELVERIFY for GADGETUP events.
>>RELVERIFY gadgets only provide GADGETUP events if the mouse is

>
>	Prop gadgets appear to produce gadgetups with relverify, even if the
>mouse is off the gadget.  Relverify really only applies to boolean gadgets
>(in terms of the verify function).  Maybe jimm will expand on this.
>
Duh... I knew that.  Silly me....


>-- 
>Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup

So I misstated and oversimplified my problem.  I hate it when that
happens.  I'll try again.

Potentiometer gadgets do not allow you to render into the container
(except for the knob).  I would like to render into the container.

So I want to simulate a slider with gadget down, mousemoves, gadget up.
I can easily do it with MOUSEBUTTONS, but then I need to check to see
that the mouse cursor is inside my simulated gadget (I also have
to ignore mousebuttons when I push other gadgets...)

Instead if I used a gadget then the "is it inside the container" check
would be handled by Inutition.  If I had a GADRELEASE flag, then
it would be really simple to simulate a potentiometer gadget just by
setting the GADGIMMEDIATE|FOLLOWMOUSE|GADGRELEASE flags.
The only thing that would be lacking would be unit-less potentiometer
values (the value from 0-1 in scaled in format).

If (in 1.4) there was a GADGRELEASE flag that was usable for BOOLEAN
gadgets then it would be much simpler to simulate sliders, and
we could avoid using MOUSEBUTTONS (and we wouldn't have to add
code to ignore them when we don't want them.)

I hope this clarifies things.

Kevin
-- 
UUCP:  kevin@uts.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,seismo,oliveb}!amdahl!kevin
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

shimoda@infohh.rmi.de (Markus Schmidt) (01/19/89)

In article <efCt2b0Yfv1010zgXWk@amdahl.uts.amdahl.com> kevin@uts.amdahl.com (Kevin Clague) writes:
>[ I'm a line-eater and I'm O.K., I eat mail at night and I sleep all day ]
Oh, a Mothy Python Line eater ...
>
Mhh, two hints.

When Intuition does not send you a GadgetUp maybe it will provide
you with a SELECTUP since the button-event has no meaning to 
intuition?!

If your duty is too consuming to be done for each movement 
do it only for the last of a bunch of arriving movemets:

while (imsg=GetMsg(w->UserPort) {
  if (imsg->Class==MOUSEMOVE) {
   ReplyMsg(imsg); 
  }
  else {
   ReplyMsg(imsg); 
   break;
  }
}

... Do your stuff ...

/* the loop isn't super-smart code :-) */

Cu
Markus

olva@geocub.UUCP (Olivier Vayssettes ) (01/19/89)

> in article <efCt2b0Yfv1010zgXWk@amdahl.uts.amdahl.com> Kevin Clague writes

>I'm having problems getting potentiometer gadgets to work the way I
>would like.  Intuition provides GADGIMMEDIATE flags for GADGETDOWN
>IDCMP events, FOLLOWMOUSE flag for MOUSEMOVE events, and
>RELVERIFY for GADGETUP events.  The problem I have is that
>RELVERIFY gadgets only provide GADGETUP events if the mouse is
>over the gadget at the time of left mouse button release.
>I would like to have a gadget flag that guarantees GADGETUP events
>if you get a GADGETDOWN event.

>Because of a RELVERIFY gadget's operation I can't be sure that
>I'll get the GADGETUP event, and then can't perform the desired
>operation.

If the user releases the mouse button inside the hit box (with RELVERIFY), the
message GADGETUP is sent. If the mouse is outside, there is no message but your
gadget is no longer selected.

I had the same problem as you. Here is my solution, it is not the best I
could hope but it works. When the GADGETDOWN message is sent, I wait until:
        - the SELECTED flag disapears (button released out of gadget)
        - or the GADGETUP message arrives (button released inside gadget)

I think too this system of flags is not complete. Any suggestions for 1.4?

					Olivier Vayssettes
				Universite de Bordeaux - France

jimm@amiga.UUCP (Jim Mackraz) (01/23/89)

In article <f0muZ2eaHu1010gCFuc@amdahl.uts.amdahl.com> kevin@amdahl.uts.amdahl.com (Kevin Clague) writes:
)
)So I misstated and oversimplified my problem.  I hate it when that
)happens.  I'll try again.
)
)Potentiometer gadgets do not allow you to render into the container
)(except for the knob).  I would like to render into the container.

No gadgets allow you to render into them, properly speaking.  The
imagery support for gadgets is enumerated in the manual.  There is no
guarantee that direct rendering will work.

)So I want to simulate a slider with gadget down, mousemoves, gadget up.
)I can easily do it with MOUSEBUTTONS, but then I need to check to see
)that the mouse cursor is inside my simulated gadget (I also have
)to ignore mousebuttons when I push other gadgets...)

How hard is that?  I use ptInBox( mousept, gadgetbox )  which took
almost 4 minutes to write, comment and compile.

)If (in 1.4) there was a GADGRELEASE flag that was usable for BOOLEAN
)gadgets then it would be much simpler to simulate sliders, and
)we could avoid using MOUSEBUTTONS (and we wouldn't have to add
)code to ignore them when we don't want them.)

If you release a boolean gadget when not over a gadget, you will get
a SELECTUP MOUSEBUTTONS message, if your idcmpflags request.

)I hope this clarifies things.

You appear to have an unnatural fear of mousebuttons.

)Kevin

	jimm
-- 
Jim Mackraz, I and I Computing	   	"Like you said when we crawled down
{cbmvax,well,oliveb}!amiga!jimm          from the trees: We're in transition."
							- Gang of Four
Opinions are my own.  Comments are not to be taken as Commodore official policy.