realbasic-nug
[Top] [All Lists]

Re: Multiple Selections in ListBoxes and Dialogs

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Multiple Selections in ListBoxes and Dialogs
From: CV <atauqua at hit dot net>
Date: Sun, 31 Oct 2004 05:51:43 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <5B5BA34E-29CC-11D9-91C6-0003930333B8 at davosystems dot com> <AFF2FB94-2A85-11D9-B2D4-000393C6C4C4 at hit dot net> <433C50C8-2AA3-11D9-BBEB-0003930333B8 at davosystems dot com>

On Oct 30, 2004, at 1:41 PM, David Harris wrote:

On Oct 30, 2004, at 11:09 AM, CV wrote:

Now I think I see what you're after. :) You want to highlight some additional existing rows beyond a block of currently selected rows? In this case, the current ListIndex holds the row number of the first of the currently selected rows. So you would do something like:

  dim i as integer
dim NumNewSelections as integer // the number of additional rows to highlight
  dim LastRowToSelect as integer

NumNewSelections = 3 //for example, to highlight 3 rows beyond existing selections LastRowToSelect = ListBox1.ListIndex + ListBox1.SelCount + NumNewSelections - 1
  For i = ListBox1.ListIndex to LastRowToSelect
    ListBox1.Selected(i) = true
  Next

HTH,

Jack


Thank you, Jack. But as I mentioned I have been trying to use the Selected(i) = True approach and it keeps clearing the previous selection, e.g. using your example it doesn't "grow" the selection, it just keeps moving down the list and selecting a single row. I'm starting to think that I'm doing something in code that is inadvertently clearing the previous selection each time.

Right. Run my example code in a new project and you'll see that it does add to the selections as intended.

Jack

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>