[comp.sys.amiga] CanDo Conundrums

jmarvin@oracle.com (11/14/90)

Some CanDo Questions:

1.  How do you create a button that can be dragged by the user?
I tried updating the object position in the drag script, by
taking the current mouse position and subtracting half it's
width and height.  Not only did this quickly fail, but while it
did execute, it drew a new button at the new location, but did
not erase the old button.

2.  How do you change the text on a text button via a script?

3.  How do you access the current position of a button via a
script?

4.  How do you create a "pop-up" menu?


Many thanks,

*******************************************************************
* John W. S. Marvin             * There are times when the wolves *
* Oracle Multimedia Development * are silent, and the moon is     *
* jmarvin@oracle.com            * howling...                      *
*******************************************************************

johnm@spudge.UUCP (John Munsch) (11/24/90)

In article <1990Nov13.175834.17747@oracle.com> jmarvin@oracle.com () writes:
>Some CanDo Questions:
Unfortunately I can answer only one...
>1.  How do you create a button that can be dragged by the user?
>I tried updating the object position in the drag script, by
>taking the current mouse position and subtracting half it's
>width and height.  Not only did this quickly fail, but while it
>did execute, it drew a new button at the new location, but did
>not erase the old button.

I wanted to have scroll bars that looked like the ones on the NeXT machine so
I had to figure this out.  The way I did it was to create my "button"
(actually my slider) as a brush.  Then I created a button on the screen that
just had a region that I could use to detect mouse clicks and drags (it had no
visible portion).  Then as part of the startup script I would copy the region
of the screen where the brush was going to be placed into another brush, then
draw the slider.  When the user clicked on my area button I could figure out
whether he/she had clicked in my "slider" area or not and move the slider with
the drag script.  I just had to paste the saved brush, copy the new save
region to it, and paste the slider brush.  It sounds complicated but it was
really very simple once I tried it.  It also gave me the ability to control
the slider externally with up and down buttons.

You should be able to do the same thing by having the entire area that the
user can move your "buttons" around on be a real area button and just use
brushes for the buttons.

>* John W. S. Marvin             * There are times when the wolves *

For answers to your other questions you might try the BBS that the
Innovatronics people run at (214)357-8511 or their section of the AMIGAVENDOR
forum on Compu$erve.

John Munsch