Deleting lines in a scrolling list box?
Ken Ray
kray at sonsothunder.com
Tue Nov 28 12:53:49 EST 2006
On 11/28/06 4:55 AM, "Scott Kane" <scott at cdroo.com> wrote:
> Hi Mark,
>
>> No global variables needed and only one button with one mouseUp handler:
>>
>> on mouseUp
>> if the hilitedLine of fld 1 is not empty then
>> delete line (the hilitedLine of fld 1) of fld 1
>> else
>> beep
>> end if
>> end mouseUp
>>
>> (Replace "fld 1" with a reference to your field).
>
> Absolutely excellent!! Thanks a heap. I knew it'd be so simple I'd kick
> myself *again*. <g> I might actually get the hang of it soon. ;-)
Note - make sure the 'multipleHilites' for the field is FALSE (meaning the
user can only select one line in the list), otherwse the script above will
fail. For a more "universal" script, that works with both single and
multiple selections, try this:
on mouseUp
if the hilitedLines of fld 1 is not empty then
put the hilitedLines of fld 1 into tHLines
put the number of items of tHLines into tNum
repeat with x = tNum down to 1
delete line (item x of tHLines) of fld 1
end repeat
else
beep
end if
end mouseUp
Have fun!
Ken Ray
Sons of Thunder Software, Inc.
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list