select all text in the field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

select all text in the field

Post by snm » Sun Apr 08, 2012 12:00 am

Hi,

How to select all the text in the field on enter it by mouse click?
Attached below handler from Dictionary is working only when navigating by TAB. After clicking on the field it seems to select all the text, but immediately the text is unselected and in place of clicking is blinking cursor.

Code: Select all

on openField
   select text of the target
end openField
LC 5.5.1 on Mac
The field is not locked. Am I missing something, or it's LC bug?

Thanks for help in advance,
Marek

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: select all text in the field

Post by Klaus » Sun Apr 08, 2012 12:31 pm

Hi Marek,

well, the text gets selected "on openfield", but then the mouseclick will also be executed,
-> set cursor in field and deselect previous selection, immediately after that!

If you add a little wait handler it will work out fine:

Code: Select all

on openfield
  wait 1 with messages
  select text of the target
end openfield
Tested and works :D


Best and happy easter

Klaus

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: select all text in the field

Post by snm » Sun Apr 08, 2012 9:28 pm

Happy Easter Klaus, thanks a lot.

I was trying to wait before select, but not with message after it.

Happy Easter to all LC Coders,
Marek

Post Reply