Select a specific line in a listField via hander

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Select a specific line in a listField via hander

Post by gyroscope » Thu Mar 26, 2009 12:38 am

Another li'l problemette I can't solve: how does one script to select a particular line in a list field (from a returninField handler).

I thought it might be highlitedline but the following code doesn't work to do that. Basically I'm after a text box user entry, a user-pressed return, the text entry added to the end of a list field, then that last line of the list field automatically highlighted (as if mouse-selected):

Code: Select all

on returninField
   set the listBehaviour of me to true
   put return after line -1 of field "List Field"
   put me after line -1 of field "List Field"
 set the Hilitedline of field "List Field" to -1
end returninField
Can any one help please?

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

Post by sturgis » Thu Mar 26, 2009 1:06 am

edit: oops, think I may have misread your question. Will go look for the right stuffs.

Look at selectedChunk, and selectedLine

quite a few "selected" items, one of em should be what you're looking for.


Have a good one

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

Post by sturgis » Thu Mar 26, 2009 1:12 am

If you're sure it will always be the last line you need, try this.

Code: Select all

select the last line of me
assuming the handler is part of the listbox. If its elsewhere use the long name

select the last line of field "fieldname"

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu Mar 26, 2009 12:03 pm

Hi sturgis

Where is that word, I put it in a drawer somewhere....D'oh!

Thank you again!

:)

Post Reply