[comp.sys.amiga] proportional gadgets

ajk@goanna.UUCP (04/23/87)

Sorry if this has been asked before.

When using a proportional gadget, I noticed that if you click the
button on the actual knob and drag it you only get a single IDCMP
message saying that a new value has been set. However, if you click
in the box to move the knob by an increment, you get MOUSEBUTTONS
messages too (button down and button up). Since Intuition is using
this information itself to manipulate gadgets, shouldnt it NOT send
mouse buttons messages? It does not send button messages when using
any other gadgets. I ended up having to clip using the coordinates
of button messages (if button down but not inside window borders,
throw it away) but extra care had to be taken for button-up in case
the user pushed the button down inside the window but then draged
the mouse and released it outside the window. YUCK!

Anyway, are the unwanted mouse buttons messges a bug or a feature?
Any way to disable this 'feature' cleanly?

Please MAIL responses. This group seems to be getting a fairly high
number of messages that seem more like personal mail than of international
interest. (In my humble opinion anyway - no flames please).
I still think this group good enough to outlay several hundred dollars
of my own money to get it into the country (Australia).

Oh, I also would like icons in a single file. I also dont use the
workbench because opening a draw take so rudy long and all those .info
files are a pain.

I also recently designed (well, my brother actually) a home brew Ram/clock/
interface to a hard disk controller card port. Gee the extra ram is nice.
Using Aztec with the +H and +I commands with the symbol table file copied
to RAM: makes compiling a series of files HEAPS faster.

Thanks in advance for any help


Alan Kent                     UUCP: {seismo,hplabs,mcvax,ukc,nttlab}
Dept of Computing                         !munnari!goanna.oz!ajk
Royal Melb. Inst. of Tech.    ACSnet: ajk@goanna.oz
124 La Trobe St               ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA
Melbourne, Victoria 3000
AUSTRALIA

spencer@eris.BERKELEY.EDU (Randy Spencer) (04/24/87)

In article <794@goanna.oz> ajk@goanna.oz (Alan Kent) writes:
>
>When using a proportional gadget, I noticed that if you click the
>button on the actual knob and drag it you only get a single IDCMP
>message saying that a new value has been set. However, if you click
>in the box to move the knob by an increment, you get MOUSEBUTTONS
>messages too (button down and button up). Since Intuition is using
>this information itself to manipulate gadgets, shouldnt it NOT send
>mouse buttons messages? It does not send button messages when using
>any other gadgets. 
>
>Anyway, are the unwanted mouse buttons messges a bug or a feature?
>Any way to disable this 'feature' cleanly?
>
>Please MAIL responses.

Well, I would mail, but this is really a question for the net.  I am 
working on that word processing project and I can't seem to figure 
out how to let the user press in that area outside that gadgets knob
and have the mouse button repeat.  I want to let the use scroll down
by pressing the mouse button down with the pointer near the bottom,
but now it only moves one window per click.

If there are any ideas out there, please fill me in on them...

>
>I also recently designed (well, my brother actually) a home brew Ram/clock/
>interface to a hard disk controller card port. Gee the extra ram is nice.
>Using Aztec with the +H and +I commands with the symbol table file copied
>to RAM: makes compiling a series of files HEAPS faster.

Do you want to post the design?  I am continuing to learn about building
hard disk interfaces, that sounds like a good thing to study and build

>Alan Kent                     UUCP: {seismo,hplabs,mcvax,ukc,nttlab}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Randy Spencer      P.O. Box 4542   Berkeley  CA  94704        (415)284-4740 
                         I N F I N I T Y                 BBS: (415)283-5469
Now working for          |||||||||||::::... . .                    BUD-LINX
But in no way            |||||||||||||||::::.. .. .
Officially representing  ||||||||||||:::::... ..    ....ucbvax!mica!spencer
                         s o f t w a r e          spencer@mica.berkeley.edu
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

cmcmanis@sun.UUCP (04/27/87)

In article <3294@jade.BERKELEY.EDU>, (Randy Spencer) writes:
>                                                         ... I am 
> working on that word processing project and I can't seem to figure 
> out how to let the user press in that area outside that gadgets knob
> and have the mouse button repeat.  I want to let the use scroll down
> by pressing the mouse button down with the pointer near the bottom,
> but now it only moves one window per click.
> 
> If there are any ideas out there, please fill me in on them...
> Randy Spencer      P.O. Box 4542   Berkeley  CA  94704        (415)284-4740 

Randy and others, this is just an idea but it should work. If you are set
to receive both MOUSEBUTTONS and MOUSEMOVE events then you could use the 
following senario ...

When you get a BUTTON_DOWN in the prop gadget you will also get a new
value for that gadget (it moves). Start a timerrequest asyncronously for
'n' micros. If you get a BUTTON_UP you AbortIO() the timer request, if
the timer request completes (Sets a Sig_bit which your while loop is 
waiting on anyway) then internally diddle the propgadget and adjust it 
again. Then reset the timer. So in psuedo code it would look something
Like ... [WINDOWSIG is a macro to get the signal bit from the user port)

    while (1) {
	Igot = Wait(WINDOWSIG(win) | 1<<Timersigbit);
 	if ((Igot & WINDOWSIG(win)) != 0) {
	   Msg = GetMsg(WINDOWPORT(win));
	   class = Msg -> Class; 
	   /* get all of the useful stuff out of Msg */
	   ReplyMsg(Msg); /* Then reply to it */
	   switch (class) {
	      case BUTTON_DOWN : set timer;
	      case BUTTON_UP : abort timer;
	      case MOUSE_MOVE : 
			if (out of gadget) abort_timer;
			else ignore;
              .... and so on handling all of the messages ...
	   }
         }
         else { /* else the timer kicked us */
           diddle prop gadget;
	   RefreshGadgets(win,propgadget,1);
	   ... update window appropriately ...
	   SendIO(timerrequest); /* kick off another timer request */
	}
    }

Note, I haven't tried this but I can't see anything obviously wrong 
with it. 

-- 
--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These views are my own and no one elses. They could be yours too, just
call MrgCop() and then ReThinkDisplay()!

dpvc@ur-tut.UUCP (David Cervone) (04/29/87)

In article <3294@jade.BERKELEY.EDU> spencer@eris.BERKELEY.EDU (Randy Spencer) writes:
>                                                             I am 
>working on that word processing project and I can't seem to figure 
>out how to let the user press in that area outside that gadgets knob
>and have the mouse button repeat.  I want to let the use scroll down
>by pressing the mouse button down with the pointer near the bottom,
>but now it only moves one window per click.
>
>If there are any ideas out there, please fill me in on them...
>
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>Randy Spencer      P.O. Box 4542   Berkeley  CA  94704        (415)284-4740 

Well, here's an idea:  you set the GADGIMMEDIATE flag in the scroll gadget,
then, when the gadget is hit, you get the message right away.  When you receive
the message, check to see if the KNOBHIT flag is set.  If it is, ignore the
hit and wait for the gadget to be releases (you also have RELVERIFY set, as
usual).  If KNOBHIT is not set, then the user has hit in one of the other
areas of the gadget.  You can tell which by comparing the current knob
position to the previous position (which you have stored in a variable
somewhere; you could use the input event's MouseX and MouseY fields, but
that becomes complicated, as the knob has ALREADY been moved, and isn't were
it used to be).  When you know which way to move, scroll that direction.  
You've probably already gotten this far without me, but here's the trick:
when you've finished with your scroll, check to see if the SELECTED flag is
set in the scroll gadget's Flag field.  If it is, the user is still holding 
down the button, so you should continue to scroll.  When he lets go, SELECTED
will no longer be set, so you stop scrolling and go back to waiting for more 
messages.  If the scrolling happens too fast (it never does, though), you 
could call Delay() to slow it down a bit.  When the user lets go, you will 
still receive a RELVERIFY message for the gadget.  When you get a RELVERY
you should check for KNOBHIT.  If it was hit, then process the scroll as though
the user moved the knob (that's what he did).  If KNOBHIT is not set, then
ignore the event, since you've already taken care of it above.

I thank that shoudl work.  If not, I have done it, and I acn go back and 
look to see in more detail what I did.

Someone asked a question about MOUSEBUTTON messages and perportional gadgets
a while back, and I just remembered something about that.  If you have a
RELVERIFY gadget, and the user presses the gadget, then moves the mouse
away from the gadget (it becomes de-selected), and then lets go, you get
a mouse up message.  If he lets go over the gadget, you get the RELVERIFY
message.  In this way, you can get a mouse up with no mouse down.  I don't
remember whether the gadget also has to be GADGIMMEDIATE, or whether it 
makes any difference.  I think it does.  I'll have to go back and try it 
out again...

Anyway, hope this is useful to someone.

Davide P. Cervone
University of Rochester
DPVC@UORDBV.BITNET
dpvc@tut.cc.rochester.edu
dpvc@ur-tut.UUCP

kim@amdahl.UUCP (05/01/87)

In article <1244@ur-tut.UUCP>, dpvc@ur-tut.UUCP (David Cervone) writes:
>          If the scrolling happens too fast (it never does, though), you
> could call Delay() to slow it down a bit.

Ahhhh ... you must not have tried Matt's fine little editor, DME, with
BlitzFonts installed!  Wheeeee ... *that* combination scrolls FAST
(sometimes *too* fast, I think)!

BTW, you should *never* call Delay() with an argument that can evaluate
to 0, as this will occasionally cause a disk to get trashed.  Wonder if
this will get fixed in 1.3 ... ?

/kim


-- 
UUCP:  kim@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
CIS:   76535,25

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