Re: button clicks

Scott Raney (raney@metacard.com)
Wed, 9 Apr 1997 14:41:11 -0600 (MDT)

On Wed, 9 Apr 1997, barney wrote:

> We have run across a button click problem that we have not yet figured
> out. Any suggestions would be greatly appreciated.
>
> If a user becomes impatient while waiting the couple secs it takes a
> page to load, and clicks the mouse button, each click is actually 'read'
> and the button action occurs. Hence, five extra clicks results in the
> next five pages being loaded before it stops.
>
> How can I fix it so MetaCard recognizes one button click, then disables
> that button until the next time I want the user to click on it. Is there
> such a command as enable/disable button function?

Yes, but your situation is more complicated than that. One might
think that the following would do the trick (my first attempt):
on mouseUp
disable me
go to next card
enable me
end mouseUp

Unfortunately as of MetaCard 2.0, mouse and button press messages are
queued up until they can be delivered (in response to people
complaining about clicking multiple times and *not* skipping multiple
cards ;-) So, the queued messages are delivered *after* the button is
re-enabled. The only way I can think to get around this is to use
"send .. in" to send a message after all the queued events have been
processed. So in the button script put something like:
on mouseUp
disable me
go to next card
end mouseUp

And in the card script of the destination card (or in the group script
if there are no openCard handlers in the card scripts):
on openCard
send enablebuttons to me in 1 second
end openCard

on enablebuttons
enable button "whatever"
end enablebuttons

Probably a better way to do this would be to have a function that
explicitly flushes the pending messages. I'll put such a function on
the feature-request list.

You might also work on reducing the time it takes to open that next
card. Some ideas:
1) If loading audio clips is what's taking the time, you might try
importing them during dead time on the current card instead of waiting
until preOpenCard for the next.
2) If starting up video clips is what's taking the time, you might try
using "prepare" to prepare a clip ahead of time.
3) If loading and/or unpacking images is the bottleneck, you might try
putting the images in a hidden group placed on both cards, and then
setting the icon property of a button where you want the image to
appear to the id of the image you want to display. As with "import" and
"prepare", you can use the "place" and "remove" commands to move the
actual work to places in your presentation where nothing else is going
on.
Regards,
Scott

> --
> v/r,
> Don 'barney' Barnhart
> barney@visicom.com (work) "To make a friend, close one
> eye.
> 904-438-9400 To keep a friend, close
> both."
> http://www.pcola.gulf.net/~barnhart
> barnhart@gulf.net (home) -Unknown
>

***************************************************************
Scott Raney raney@metacard.com http://www.metacard.com
Any sufficiently advanced technology
is virtually indistinguishable from magic -- Clark's law