deleting lines from a list-field

Nicolas Cueto niconiko at gmail.com
Mon Jun 23 22:57:48 EDT 2008


I'm hoping there's an elegant
way of doing the following,
cause my "solution" is pretty
messy.

I have a locked field set to
list-behavior, multiline, and
non-contiguous. Now, say
that in that field there are
10 lines, of which the user
has selected lines 1, 3-to-6
and 8 for deletion.

My first solution so far is to
put a mouseDouble up
handler in the field and then
use the field's hilitedline
property, something like this:

on mouseDoubleUp
  put the hilitedline of me into tLinesToDelete
    repeat for each item tLineNr in tLinesToDelete
        delete line tLineNr of me
    end repeat
end mouseDoubleUp

But, of course, the problem with
this is that after the first deletion
the line numbers in hilitedLine
no longer correspond to the
actual line numbers in the field.

Like I say, I've kludged up one
possibile way of doing this, but
there's got to be a better way,
isn't there?

Thanks.

--
Nicolas Cueto



More information about the use-livecode mailing list