Date: Wed, 7 Dec 1994 14:51:38 EST From: John Dowdell <71333.42@COMPUSERVE.COM> > We would like to let the user use the TAB key to switch > between fields, like it was possible in D 3.xShould still be a "go", Benoit... that "Auto-Tab" dialog in the textfields' "Cast Info" dialog still enables this. I've gotten stung by my QuicKeys before... that's the only thing that comes to mind for why it wouldn't work.
But a related thought: there's a neat hack discussed recently for shift-tabbing backwards through editable fields, or to allow the RETURN key to do the same types of tasks....
That "editableText" property enables a set of default behaviors. Usually, if you want to customize that behavior, it's best to just script your own key event handler... beats mixing together locked-in default behaviors and customized behaviors.
But there's a low-script way to enable variants on tabbing between fields. Suppose there are five fields on Stage. Duplicate this frame so it fills five frames. They're visually identical, but each frame has only one field that's editable... four fields are display-only and one field can be typed into in each of those five frames... each field has its own frame where it alone is editable.
If each "exitFrame" handler does a "go the frame", then we can set up a key handler in each of those Frame Scripts so that we go forward or backward a frame, depending on which key the user presses. For instance:
on exitFrame
go the frame
end exitFrame
on keyDown
if the key = TAB or the key = RETURN then
if the shiftDown then go the frame - 1
else go the frame + 1
end if
end keyDown
We'd need to check for the first or last of those five frames so we loop around
the sequence -- can be done either by frame tests or by a different script or
such -- but this is a nice simple way to customize auto-tabbing with a minimum
of scripting.
Date: Thu, 8 Dec 1994 14:38:13 +1030 From: Matt Craig <mnmac@FLINDERS.EDU.AU> Subject: Re: Switching between editable text fieldsInteresting approach with the frames, but a little cumbersome (I'm never averse to cutting down on the workload :)
Instead of copying a bunch of text fields over frames, and having the hassle of changing everything if you do a layout change or whatever, you can have the same result using "the editableText of sprite" command, and having a list of your sprites
I made a quick couple of handlers that firstly initialise a list containing the sprite numbers for the text fields, then just use another handler which switches the editableText of each with each press of the TAB key, and cycles backwards with a SHIFT+TAB.
btw, it's pretty rough, but works ok
on initialise
global sTextList,textPos
set sTextList to [1,2,3,4,5]
set textPos to 1
when keyDown then checkKey
end
on checkKey
global sTextList,textPos
if the key = Tab then
set oldPos to textPos
if the shiftDown then
if textPos = 1 then
set textPos to count(sTextList)
else
set textPos to textPos - 1
end if
else
if textPos = count(sTextList) then
set textPos to 1
else
set textPos to textPos + 1
end if
end if
set oldSprite to getAt(sTextList,oldPos)
set newSprite to getAt(sTextList,textPos)
set the editableText of sprite oldSprite to false
puppetSprite oldSprite,false
puppetSprite newSprite,true
set the editableText of sprite newSprite to true
end if
end
So this can be done in one frame, with whatever text fields you like.
Matt Craig
Flinders Medical Centre
South Australia
Email mnmac@flinders.edu.au