tom@wcc.oz (Tom Evans) (10/31/90)
I have a stack that requires people to enter information in order to configure some hardware. I've found that people can use it better if I flash the "recommended" next button in an idle handler in the card script (especially in the cards that are a bit "busy"). Whenever the script "flips" the button (set the hilite of button x to not the hilite of button x) I lose the insertion point, and any typed characters go into the Message Box (if it is showing, else sysBeep). Is there any way around this behaviour? (HyperCard 1.2.5, MF IIcx etc). Please mail responses, this group is getting away from me! Thanks. ======================== Tom Evans tom@wcc.oz.au Webster Computer Corp P/L, 1270 Ferntree Gully Rd Scoresby, Melbourne 3179 Victoria, Australia 61-3-764-1100 FAX ...764-1179
jdevoto@Apple.COM (Jeanne A. E. DeVoto) (11/01/90)
[Mail went "boing!".]
In article <1125@wcc.oz> tom@wcc.oz (Tom Evans) writes:
[that he wants to know how to preserve the location of the insertion
point when a button is hilited.]
The workaround is to check and restore the selection after you hilite
the button. An example:
on idle
get the selectedChunk -- store the insertion point location
set the hilite of card button "Reminder" to true
wait 10 ticks
set the hilite of card button "Reminder" to false
select it -- restore the insertion point
end idle
This puts the insertion point back where it belongs after you're
finished hiliting.
Actually, the most common problem of this type is seen when a user
clicks an autohiliting button. A solution for this more common case
is
on mouseDown -- in button's script
put the selectedChunk in to mySelection
repeat while the mouse is down -- emulate autohiliting behavior
if the mouseLoc is within the rect of the target then
set the hilite of the target to true
else
set the hilite of the target to false
end if
end repeat
if the mouseLoc is within the rect of the target then
-- mouse was released within the button
-- do whatever you want to do on a button press
-- this may include doing something to mySelection, such
-- as boldfacing it, etc.
end if
select mySelection
end mouseDown
This handler can also be used to make other types of button hiliting
-- for instance, changing the icon or button style rather than the
hilite to show that a button is being clicked -- behave like autohiliting,
with the state changing as you move the mouse on or off the button.
--
========= jeanne a. e. devoto ========================================
jdevoto@apple.com | You may not distribute this article under a
jdevoto@well.sf.ca.us | compilation copyright without my permission.
______________________________________________________________________
Apple Computer and I are not authorized | CI$: 72411,165
to speak for each other. |