Get active line in 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
doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Get active line in field

Post by doobox » Sun Mar 25, 2012 4:31 am

Hi there,

I cant seem to find the way to get the active line (currently flashing text cursor), in a text field..?

I am needing something resembling :

on textChange
put the activeLine of field "textField" into tCurrentWorkingLine
end textChange
Kind Regards
Gary

https://www.doobox.co.uk

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Get active line in field

Post by doobox » Sun Mar 25, 2012 6:45 am

Ahhh.. got it..

Code: Select all

on mouseUp
   put "test" after the selection
   put  the lineIndex of the selection into tCapturedLine
   put line tCapturedLine of field "test" into field "capturedLine"
end mouseUp
Kind Regards
Gary

https://www.doobox.co.uk

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

Re: Get active line in field

Post by Klaus » Sun Mar 25, 2012 12:15 pm

Hi Gary,

... the lineindex of the selection...???? 8)
Where did you find this?


Best

Klaus

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Get active line in field

Post by Dixie » Sun Mar 25, 2012 12:35 pm

Klaus...

He got it from the dictionary...:-)

be well

Dixie

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

Re: Get active line in field

Post by Klaus » Sun Mar 25, 2012 12:50 pm

Oh, this is LC 5.5, right?
OK, in that case I will not find it in MY dictionary yet :D

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Get active line in field

Post by doobox » Sun Mar 25, 2012 1:18 pm

I did not find it in the dictionary.. Just guess work. Does the job though :-)
Kind Regards
Gary

https://www.doobox.co.uk

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

Re: Get active line in field

Post by Klaus » Sun Mar 25, 2012 1:29 pm

Hi Gary,

well, it IS not in the dictionary, that's what's puzzling me :-)
So are you using LC 5.5?


Best

Klaus

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Get active line in field

Post by doobox » Sun Mar 25, 2012 1:32 pm

Here is the concise way i ended up using it :

Code: Select all

on textChanged
   put  the lineIndex of the selection into tCapturedLine
   put line tCapturedLine of me into field "currentLine"
end textChanged
Year 5.5 but i don't see it in dictionary here either.
Kind Regards
Gary

https://www.doobox.co.uk

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Get active line in field

Post by doobox » Sun Mar 25, 2012 1:39 pm

I tell a lie... lineIndex is there :

Examples:
-- Example: 2 lines of text in a field
-- Hello World
-- Goodbye World

the lineIndex of char 7 of field 1 -- 1
-- char 7 is on line 1


the lineIndex of word 4 of field 1 -- 2
-- word 4 is on line 2
Kind Regards
Gary

https://www.doobox.co.uk

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Get active line in field

Post by sturgis » Sun Mar 25, 2012 2:16 pm

Ok wow. I obviously need to go through the new dictionary!

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

Re: Get active line in field

Post by Klaus » Sun Mar 25, 2012 3:48 pm

Looks like I need to get some bucks and buy the update :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Get active line in field

Post by jacque » Sun Mar 25, 2012 5:42 pm

The first thing I always do after a release is read the release notes, which are in the Help menu. At the bottom of the notes is a summary of all the new features. Then I know what to look up in both the release notes and the dictionary.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply