From: Amy Blankenship-Adobe Community Expert on

"Steve Howard" <steve(a)magnoliamultimedia.com> wrote in message
news:fk9547$if9$1(a)forums.macromedia.com...
> You want something like
>
> If CharCount(wcGetPropertyValue(ActiveControlID, #Text))=4 then
> PressKey("Tab")
> end if

You're probably better off just explicitly setting focus to the correct
control...


From: Steve Howard on

> That's exactly what I was thinking of doing. What would be the best way to
> do
> that? I have on my flowline a series of controls, some that set up the
> memo
> input and some that set the properties for character limits. They are all
> set
> up on the flowline one after the other, then a control to force the focus
> on
> the first control.
> Would I have to set up the calculated response as a perpetual interaction?
> Where would be the best place to put it?
> If anyone could help with the coding that would be awesome. It's been a
> few
> years since I used Authorware, I'm trying to get my feet wet again.
> Thanks for the help
>

Sounds like you used the KOs to create the controls. I never use these, so I
don't have any code specifically designed to work with them.

What you need to do, roughly, is:-

- assign each of them the same ChangeEvent variable
- then create an interaction beneath all of the controls you create that
watches for changes to the ChangeEvent variable, and does the appropriate
checking etc.

Note - ChangeEvent triggers (changes from zero to -1, -2 or whatever) and
immediately returns to zero. Set your Calculated response to trigger when
your ChangeEvent variable is not equal to zero.

Take a little time to play with the controls, trace the value of the
ChangeEvent var and read the help... you should be able to get there pretty
easily :-)

Steve


--
Adobe Community Expert: Authorware, Flash Mobile and Devices
http://www.magnoliamultimedia.com

From: Chris Forecast on
"Rodimus_Prime" <webforumsuser(a)macromedia.com> wrote in message
news:fk92de$ff7$1(a)forums.macromedia.com...
> When my CharCount variable reaches 4, it should process the
> PressKey, but it doesn't. Am I missing something obvious here?

Safer (and more reliable) to simply set focus to the next control, in the
way that Amy suggested.

It still seems to me that there will be lots of complications with this
which you may not have considered. What would happen, for example, if a user
types X which gets entered as the last entry for control 1, focus then jumps
to control 2, then they press the delete key? Would you want the X to be
deleted? etc... etc...

Chris Forecast


From: Amy Blankenship-Adobe Community Expert on

"Rodimus_Prime" <webforumsuser(a)macromedia.com> wrote in message
news:fk8cj5$le2$1(a)forums.macromedia.com...
>I think I'm starting off on the right track. I'm trying to use the function
> wcGetFocusedControl() in a perpetual icon in order to constantly check
> what
> control is in focus. With that, I can use if statements to determine when
> to
> shift focus to the next control. I have an interaction icon set as
> conditional
> (condition is "TRUE") to be perpetual. In that is a calculation icon with
> a
> repeat statement. But I can't get the repeat statement to update the
> variable
> assigned by wcGetFocusedControl().

OK, the easiest way to do this is to create a list variable. I'll call it
wcList. Let's say you have a map that has all your controls in it. I'll
call it "Control Map." Inside each KO, change the variable name that you
used in each one to:

wcList[n]

Where n is the child number of each WinCtrl within "Control Map."

Change your set control value to refer to wcList[Listcount(wcList)]

Now, below all the WinCtrls, set up an interaction with a Conditional
response, condition wcChange (assuming that is your winctrl change
variable), Automatic set to False to True.

Inside that response, something like this:

numLoops := Listcount(wcList)
focusedControl := wcGetFocusedControl()
controlIndex := 0

repeat with x := 1 to numLoops
if focusedControl = wcList[x] then
controlIndex = x
exit repeat
end if
end repeat

newIndex = Test(controlIndex<numLoops, controlIndex +1, 1)

wcSetPropertyValue(wcList[controlIndex], "focus", false)
wcSetPropertyValue(wcList[newIndex], "focus", true)

HTH;

Amy


From: Steve Howard on

> You're probably better off just explicitly setting focus to the correct
> control...

Maybe, but since he used the KOs, I figured pressing Tab would be easier
than him trying to figure out which is the next control ;-)

Steve


--
Adobe Community Expert: Authorware, Flash Mobile and Devices
http://www.magnoliamultimedia.com