If I am not mistaken, Focus on me triggers an open field message that gets sent
to the field. Of course this will cause an endless loop. But if you passed
openField, your focus would already be on the target. Why would you need to
focus again?
If the Answer dialog is causing you to lose focus, then obviously you cannot do
it this way. You have to offer the choice outside the openField handler
somehow. In other words, openField cannot trigger anything that will cause your
field to lose focus. Yes?
It's like saying
on bake cookies
make batter
if there is batter then
bake cookies
end if
end bake
You'll be busy for quite a while.
Bob
On Jul 6, 2011, at 5:41 PM, Tom Johnson wrote:
> Hello,
> I'm running into a similar problem as another that's currently on the list.
> What I'm trying to do is
> keep the focus on the field where the script below lives. If I do a simple
> "focus on me" or
> something similar it goes into a loop of openField. If there's a way to keep
> the focus
> in the field please fill me in. If there's something wrong with my approach,
> I'm
> open to suggestions. There other fields and buttons on the card with this
> field too. If
> the focus stays in the field the rest of the script does work.
>
>
> Thanks,
> Tom
>
>
> *-------------------- *
>
> *local* nFormatChosen
>
> *on* openField
>
> *if* the highlite of button "European" of *group* "Addess Format" is true
> *then*
>
> *answer* "Choose the format" with "A" or "B" or "C" or "Cancel" as *
> sheet*
>
>
>
> *if* it is "Cancel" *then* *exit* to top *else*
>
> *put* it into xFormatChosen
>
>
>
> *switch* xFormatChosen
>
> *case* "A"
>
> *put* "+11-(" & "1" & ")" & "1111" && "111111" into nFormatChosen
>
> *break*
>
> *case* "B"
>
> *put* "+11-" & "(" & "111" & ")" & "1111" && "1111" intonFormatChosen
>
> *break*
>
> *case* "C"
>
> *put* "+11-" & "[" & "1111" & "]" && "111" && "1111" intonFormatChosen
>
> *break*
>
> *end* *switch*
>
> *end* *if*
>
> *pass* openField
>
> *focus* *on* the target *-- This starts the loop*
>
> *end* openField
>
>
> *on* keydown pKey
>
> *delete* the selectedtext
>
>
>
> *if* the highlite of button "USA" of *group* "Addess Format" *then*
>
> RightFormat "+11" && "111-111-1111", pKey,the short name of me
>
> *else*
>
> *if* the highlite of button "European" of *group* "Addess Format" *then*
>
> RightFormat nFormatChosen ,pKey,the short name of me
>
> *else*
>
> RightFormat "+11" && "111-111-1111", pKey,the short name of me
>
> *end* *if*
>
> *end* *if*
>
> *end* keydown
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode