Page 1 of 1
Selecting text in a field with script
Posted: Wed Jun 12, 2019 3:08 pm
by sritcp
I have a regular text field (not list field).
When I type in the message box
nothing happens! (well, sometimes the word gets highlighted for a split second).
Is it not possible to select text by script in an editable text field?
Thanks,
Sri
Re: Selecting text in a field with script
Posted: Wed Jun 12, 2019 3:21 pm
by dunbarx
Confirmed here from the message box in both v.8 and v.9.
But works fine in a button script.
Craig
Re: Selecting text in a field with script
Posted: Wed Jun 12, 2019 4:21 pm
by sritcp
Craig:
Something to do with the currently active window being the Message Box, not the card with the field.
Create Button1 with the script
Code: Select all
on mouseUp
selectWord
end mouseUp
command selectWord
select word 3 of field "Field1" of this card
end selectWord
Now, from msg
send "selectWord" to button "Button1"
doesn't work.
Neither does
send "mouseUp" to button "Button1"
But, clicking on Button1 does work.
Regards,
Sri
Re: Selecting text in a field with script
Posted: Wed Jun 12, 2019 6:01 pm
by dunbarx
Sri.
Sort of.
If, in msg, I give an explicit stack reference:
Code: Select all
select word 2 of fld 1 of stack "untitled 1"
I get the flash selection you mentioned, that very soon disappears.
But if I place a button with that same handler in another stack, it selects just fine in the target stack.
So since the other stack and the message box are both "just" stacks, it is msg that has issues. This has long been known with the message box, and we all live with them.
Craig