realbasic-nug
[Top] [All Lists]

Re: Clarification - Listbox and Checkbox

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Clarification - Listbox and Checkbox
From: Terry Ford <tmford at shaw dot ca>
Date: Fri, 28 Jul 2006 19:28:17 -0700
Cc: Charles Kelley <ckelley at lrcm dot usuhs dot mil>
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <56591 dot 131 dot 158 dot 15 dot 147 dot 1154105925 dot squirrel at mail dot lrc dot usuhs dot mil>

On Jul 28, 2006, at 9:58 AM, Charles Kelley wrote:

Hi, all!

        I have a listbox with a column of checkboxes
that indicates whether or not a row is selected.
I'm trying to implement a "Select All" menu item
that would make sure all the rows in the listbox
are selected.

Is it the rows themselves you want selected, the checkboxes or both?

Corrected Quote:

        If I do something like

for every = FIRST to listbox.listCount-1
        listbox.cellCheck(every, kColumnSelected) = TRUE
next // every cell

I am assuming that First = 0 and kColumnSelected is the column with the checkboxes (as Integer).

I also added -1 to listbox.ListCount as it would otherwise cause a OutOfBounds exception. Remember there is a Row 0 at all times even if there isn't data in it so 0 to 5 is Listcount = 6 but the last row is 5.

in the menu handler, is any event fired? If so,
which one? I've looked in the online reference
and the printed reference manual, but I haven't
found an answer.

In the above code neither CellAction nor CellClicked is fired if in code but will be if done with the mouse.
The checkboxes will all be set to true.

FYI. If the mouse is clicked outside the checkbox the CellClick event will be fired. If the mouse is clicked inside the Checkbox the CellClick event will be fired and then the CellAction event will be fired.

I hope this helps but I made some assumptions from your variable names which weren't fully explained.

Terry

PS. Here's the code I used in a menuhandler for EditSelectAll where column 0 is the checkbox column.
-------------------------------------
  Dim every, FIRST,kColumnSelected As Integer

  First=0
  kColumnSelected=0

  for every = FIRST to ListBox1.listCount-1
    listbox1.CellCheck(every, kColumnSelected) = TRUE
  next



_______________________________________________
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>


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