Page 1 of 1

To focus on field without have the text selected

Posted: Thu Feb 20, 2014 2:05 am
by Mag
Hi all!

I'm trying to use the focus on field command in a series of fields with lockText true, unfortunately when the field get the focus the entire text of the field is selected, is there a way to avoid the text selection when move from a field to another?

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 2:14 am
by dunbarx
Hi.

Not sure how you are doing this, but if you focus on a field that contains text, the default behavior is to set the cursor at the end of that text, not to select all. Anyway, try this in a button somewhere:

Code: Select all

on mouseUp
   focus on fld 1
   select empty
end mouseUp
Craig

EDIT: Hmmm, this seemed reasonable, but of course selecting empty defocuses the field. Try something else...

More Hmmm. Setting the cursor to none and locking does not work. And why should it? There are always two cursors when a blinking one is in the field and the "ordinary" one is hanging around the card.

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 2:45 am
by Mag
Maybe select text something? But what? :oops:

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 3:38 am
by dunbarx
OK.

This has to win the silver for ugliest kluge of the Olympics. It works, and if you never do anything to the text of that field it can stay. Otherwise, ugh.

In a button script, with a field with text in it:

Code: Select all

on mouseUp
   get the scroll of fld 1
   focus on fld 1
   repeat 100
      put  return after fld 1
   end repeat
      select after text of fld 1
      set the scroll of fld 1 to it
end mouseUp
Oh. Did I mention it was awful?

Craig

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 9:48 am
by LCNeil
Hi Mag,

Just tried this and it seems to work (Mac OSX)

Code: Select all

on mouseUp
   focus on fld 1
   select char 0 of fld 1
end mouseUp
Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 4:21 pm
by dunbarx
Neil.

Right. Thank heaven.

Craig

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 6:13 pm
by jacque
A bit of trivia: fields with autoTab set to true will auto-select the entire field content. Fields with autoTab set to false will set the insertion point at the end. Or at least it used to be that way, I haven't checked in a while.

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 7:25 pm
by dunbarx
Jacque.

That is right. Forgot about autoTab

Mag, listen to Jacque.

Craig

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 9:36 pm
by Mag
runrevneil wrote:Hi Mag,

Just tried this and it seems to work (Mac OSX)

Code: Select all

on mouseUp
   focus on fld 1
   select char 0 of fld 1
end mouseUp
Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-

Thank you Neil works fine and it suits perfectly the needs of my current project. :D

So now I replaced

focus on field "abc"

with

select char 0 of fld "abc"


Thank you Jacque and Craig for your help!

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 10:06 pm
by dunbarx
Mag,

So your instinct about "select something..." was spot on.

Craig

Re: To focus on field without have the text selected

Posted: Thu Feb 20, 2014 11:22 pm
by Mag
dunbarx wrote:Mag,

So your instinct about "select something..." was spot on.

Craig
Hehehe
:lol: