Selecting Hilited Text In Scrolling List Field?

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
Knightlite
Posts: 51
Joined: Mon Jan 23, 2012 10:14 pm

Selecting Hilited Text In Scrolling List Field?

Post by Knightlite » Thu Mar 29, 2012 9:31 pm

Hi,

I have another what I would consider simple question that I can't seem to figure out about the Scrolling List Field. I don't see anything in the documentation that covers this either.

I have a list displayed in a scrolling list field that is also grouped with the MobGui scroller control for an iPad app. The name of the Scrolling List Field is List1 and the MobGui scroller is called Scroll1.

I select a line in the list and it becomes hilited. I want to the have that hilited line of text copied to a text field called txtChapter1.

In Basic the code would be simply:

Code: Select all

txtChapter1.Text= List1.Text
I try doing this code in LiveCode:

Code: Select all

put field "List1" into field "txtChapter1"
But what it does is return all the content in the list and not just the selected hilited text.

Does anyone know what the code is for taking the hilited text from the Scrolling List to the the text field txtChapter1?

Any help would be appreciated.

Jim

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Selecting Hilited Text In Scrolling List Field?

Post by mwieder » Thu Mar 29, 2012 9:34 pm

Jim-

Code: Select all

put the selectedtext of field "List1" into field "txtChapter1"

Knightlite
Posts: 51
Joined: Mon Jan 23, 2012 10:14 pm

Re: Selecting Hilited Text In Scrolling List Field?

Post by Knightlite » Thu Mar 29, 2012 9:55 pm

Hi mwieder,

Thank you again for helping me out. The code works fine when I put in on a button and execute it. It works great, but how do you add it to the Scrolling List control?

Buttons have events such as mouseUp and mouseDown, but this list control does not seem to have any events you can paste the code into... Just an empty list to enter code. When I put the code in there it does not work.

I wish there was more documentation and sample code on the Scrolling List control. I just don't understand how it is suppose to work.

Jim

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Selecting Hilited Text In Scrolling List Field?

Post by mwieder » Thu Mar 29, 2012 10:11 pm

Jim-

mouseUp works fine (and is what you want) in a scrolling list field's script.

Code: Select all

on mouseUp
  put the selectedtext of me into field "txtChapter1"
end mouseUp

Knightlite
Posts: 51
Joined: Mon Jan 23, 2012 10:14 pm

Re: Selecting Hilited Text In Scrolling List Field?

Post by Knightlite » Thu Mar 29, 2012 10:20 pm

Thanks again. That worked great. I forgot you have to build the event yourself. It seems like the other controls have the events built already.

I'm just trouble getting used to this new code. The syntax is really easy, but kind of different than what I am used to.

I am sorry to keep bothering you. I won't be asking any more questions today. I think I used up my limit.

This is a great forum, and I am trying to really go through the documentation before I bother anyone, but although their is a wealth of information, I can't always seem to find what I am looking for.

Thanks again.

Jim

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

Re: Selecting Hilited Text In Scrolling List Field?

Post by jacque » Fri Mar 30, 2012 6:17 pm

Please don't be sorry about posting! That's what the forum is for, and everyone is always glad to help. Not only that, but your questions will help others who may be too shy to post. They will find your question when they search, and learn.

There is nothing too simple to ask, and there are huge advantages -- you'll learn faster, your frustration level will decrease, and you'll be helping the community besides. Post everything and anything. Please.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: Selecting Hilited Text In Scrolling List Field?

Post by seaniepie » Sat Apr 14, 2012 12:55 am

Indeed, it just helped me out. Thanks all.

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Selecting Hilited Text In Scrolling List Field?

Post by carel » Fri Sep 06, 2013 5:15 pm

I hope this thread is still alive...

I want to select the line that was clicked on in a scrolling list, for example:

on mouseUp
select the line of the field that was clicked on (or something to that effect)
end mouseUp

Thanks,

Carel

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Selecting Hilited Text In Scrolling List Field?

Post by carel » Fri Sep 06, 2013 5:41 pm

I figured it out!

Select a line in a scrolling list field (Helping google out here)

Maybe it will help someone that googles it:

Set List behaviour of the field to "Click to toggle"

on mouseUp
select the clickline
put the value of the clickline into mytest
answer mytest
end mouseUp

Carel

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

Re: Selecting Hilited Text In Scrolling List Field?

Post by jacque » Fri Sep 06, 2013 7:16 pm

Good work. :) You don't even need the "select the clickline" part; a field that has listBehavior set will automatically hilite.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Selecting Hilited Text In Scrolling List Field?

Post by carel » Fri Sep 06, 2013 9:29 pm

Oh, thanks - really starting to enjoy Livecode now... just a pity google results are so weak - with VB6 I used to get instant results when googling "vb6 how to do this or that"

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

Re: Selecting Hilited Text In Scrolling List Field?

Post by jacque » Fri Sep 06, 2013 10:11 pm

In that case you need one of these:

http://runtime-revolution.278305.n4.nabble.com/
http://dir.gmane.org/gmane.comp.ide.revolution.user

Those have identical content, different interfaces. They contain archives of the mailing list going back years. The forum here is a newer addition, before that everything was on the list -- and it's still active now too. Just be aware that some very old posts may be out of date and there may be a better way to do something now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply