At 8:08 PM +0100 4/14/06, Bernard Sunderland wrote:
A window has a ListBox which allows multiple selection and a
PushButton with the following simple code:
for n=0 to (List1.listcount-1)
if List1.selected(n) then List1.removeRow(n)
next
When a number of rows are selected and the PushButton is pushed, the
result is that the first row selected and other alternate rows are
deleted and the rest are skipped.
This is a case of the computer doing exactly as you said, and not
what you meant. To see what's going on, make a simple example on
paper with say six rows, with four in a row selected. Then go
through the code, line by line, and "be the computer." Do exactly
what it says to do.
You should see exactly the same result: you delete a row when (say)
n=2, which of course means that the old row 3 is now row 2. Then you
go on to the new row 3 (at the "next" statement), never looking at
the new row 2 (which was the old row 3).
The easiest solution is to go backwords, from List1.listCount-1 DownTo 0.
Incidentally, I find it very annoying that checking a check box does
not fire the 'Change' event. Surely it should?
No, it does not cause a change in the selection, which is what the
Change event signifies. It does cause a CellAction, though.
Best,
- Joe
--
Joe Strout -- [EMAIL PROTECTED]
Available for custom REALbasic programming and training.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>