Page 1 of 1

Can I retrieve non-contiguous selected lines from ListField?

Posted: Mon Feb 20, 2012 7:39 am
by BarrySumpter
Hi all,

I have 2000 vids I want to make a playlist from.

If I drag n drop say 37 files into a a livecode textfield
I than want to select all the .mov or all the .avi with a single button
Or multiselect all the movies I consider action movies.
Then I want to do something with just those selected lines etc.

I'm absolutely sure I've covered this topic before but I can't find my post about retrieving only the select lines from a textfield
And processing them one line at a time.
This project looks huge for such a simple task.
is there an easier way?
i.e. the brilliant way livecode handles text chunks, etc.

21204-shifting-selected-text-to-the-right-or-left
http://lessons.runrev.com/s/lessons/m/2 ... ht-or-left

Also, I can't seem to select non-contiguous lines in a textField. Is this possible?

Many thanks in advance

Re: Can I retrieve non-contiguous selected lines from ListFi

Posted: Mon Feb 20, 2012 7:44 am
by BarrySumpter

Code: Select all

      repeat with x = 1 to number of items in the hilitedLines of field field0  
         put return after str1
         put item x in the hilitedLines of field field0 into selectedLineNumber
         put x & ": " & line  selectedLineNumber of field field0 after str1
      end repeat
--
      set the text of field Field1 to str1
Anyone know how to set the properties of a ListField to allow selection of non-contiguous lines?

Re: Can I retrieve non-contiguous selected lines from ListFi

Posted: Mon Feb 20, 2012 9:22 am
by bn
Hi Barry,

you can turn on non-contiguous in the properties inspector for the list field. Multiple lines option also has to be checked.

Code: Select all

put the selectedText of field 1
gives you a list of the selectedText, one line for each selected line.

Kind regards

Bernd

Re: Can I retrieve non-contiguous selected lines from ListFi

Posted: Mon Feb 20, 2012 9:58 am
by BarrySumpter
Blast.

Am I getting my TextFields and ListFields mixed up?

Can't seem to get the Text Field to select non-contiguous lines.

Or is it the drag n drop that I'm not setting up properly?
Or is it MAC OS X Lion?

ListBehaviour ticked on
MultipleHighlights ticked on
non-contiguous ticked on

Re: Can I retrieve non-contiguous selected lines from ListFi

Posted: Mon Feb 20, 2012 10:07 am
by bn
Hi Barry,

I probably don't quite understand what you want.

if you want to set the hilitedLines by script in a list field with
ListBehaviour ticked on
MultipleHighlights ticked on
non-contiguous ticked on

then you can set them

Code: Select all

on mouseUp
   put "1,4,7" into tToHilite
   set the hilitedLines of field 1 to tToHilite
end mouseUp
if that is not it then please explain again what is not working.

Kind regards

Bernd

Re: Can I retrieve non-contiguous selected lines from ListFi

Posted: Mon Feb 20, 2012 10:11 am
by BarrySumpter
OK thanks Bernd.

LOL.
It was me.
Surprise, Surprise, Surprise!

MAC OS X is not my native development environment.
Fumbling around on the MAC Book Pro keyboard was driving me crazy.
So using logmein to control my macbookpro,
I found the apple command button to be the Windows Start button on my MS Natural Multimedia keyboard.
:oops:

It looks like the textbox does NOT have the ListBehaviour ticked on.
And the ListBox is just a textbox which has the ListBehaviour ticked on.
The text chunk works the same way on both I would deduce.

Somethings as simple as that makes me doubt everything.
It doesn't have to be this hard.
I'll be kicking meself for a while.