Selecting text in single-line entry fields - small UI issue

Paul Hibbert paul at livecode.org
Fri Jan 29 14:32:45 EST 2016


Roland,

The best I can come up with is using the openField and closeField messages to set the colour of the line within the field, instead of setting the background colour of the field, this gives you a little more control over the position of the ‘highlighted' area. Something like this in a behaviour button then applied to the required fields:

on openField
   set the hilitecolor of me to Blue
   set the backgroundcolor of line 1 of me to the hilitecolor of me
   set the padding of line 1 of me to 4
   set the textColor of me to "255,255,255"
   select the text of me
end openField

on exitField
   set the backgroundcolor of line 1 of me to "255,255,255"
   set the textColor of me to "0,0,0"
end exitField

Sorry I can’t test for the disappearing text because I’m on Mac.

As Jacque suggested, I also expected the focusIn and focusOut messages would be helpful, but it seems they are not triggered buy opening or closing an unlocked field (see comment in the dictionary).

This lesson explains a little more so maybe helpful:
http://lessons.livecode.com/m/4071/l/58674-how-do-i-style-paragraphs-in-a-field-in-livecode-5-5

Paul



More information about the use-livecode mailing list