Text box single line

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Text box single line

Post by bsouthuk » Tue Feb 15, 2011 12:00 pm

HI Guys

I've build a CRM in Runev and I cant work out how to ensure a 1 line text does not allow 2 lines of text in it. I thought I had achived this by changing some of the field settings. i.e. tab after return and Dont Wrap.

However, when my users copy and paste 2 lines of text from a website for instance in the field, it allows both lines to be copied when its important that only the first line is pasted.

Does anyone have any suggestions?

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

Re: Text box single line

Post by Klaus » Tue Feb 15, 2011 12:09 pm

Hi Daniel,

you could trap the "pastekey" message to check
the clipboarddata["text"]
for its number of lines and only "paste" line 1 of it.

Or you can check the field(s) in an "on exitfield" handler and delete the last line if neccessary.

HINT:
The "pastekey" handler will NOT work in the IDE, but in a standalone! :D


Best

Klaus

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: Text box single line

Post by bsouthuk » Tue Feb 15, 2011 12:24 pm

ahhh brilliant thanks Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Text box single line

Post by dunbarx » Tue Feb 15, 2011 5:40 pm

Perhaps you can write an "mouseEnter", "openField" handler in your field that would set the clipboardData to line 1 of the clipBoardData?

Craig Newman

Post Reply