image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Articles
   3D
   Audio
   Custom Controls
   General RB
   Graphics
   Hacks
   Mac OS X
   Menus
   Novelty
   Printing
   REALbasic 2005
   REALbasic 2006
   Registration
   Resources
   Reviews
   Serial
   Speech
   Sockets
   XML
   Video
Resource Links
News
   Current News
   February 2006
   January 2006
   December 2005
   November 2005
   October 2005
   September 2005
   August 2005
   July 2005
   June 2005
   May 2005
   April 2005
   March 2005









REALbasic for Dummies
by Erick Tejkowski


Learning REALbasic through Applications
by Clayton E., Crooks II


REALbasic for Macintosh
by Michael Swaine


REALbasic Cross-Platform Application Development
by Mark S. Choate





Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander
Tell us about a bad link. Thank You!

Listbox Checkboxes by Erick Tejkowsi
05-30-03

Printer Version




Someone on the REALbasic NUG email lists today wanted to know how to use checkboxes in a Listbox control. To help him out, this week's tutorial will show you how to display checkboxes in a listbox and how to find out if a particular checkbox is checked or not.

Build the Interface
Fire up REALbasic and add a Listbox, an Editfield, and a Pushbutton to Window1. You can arrange the interface however you want, but mine looks like this: (note - the Listbox is on top)

5-30-03_img1.jpg (18k)

Add the Code
The code for this example looks like most Listbox code, with a few exceptions. First, we'll designate our Listbox as having three columns that display headings. Then, we need to assign a type to each column using the columnType property. There are a few choices:

  • 0 - default
  • 1 - text
  • 2 - checkbox
  • 3 - editable text
We'll set the first column (i.e. column 0) as a checkbox, the second column as non-editable text, and the third column as editable text. Finally, we populate the Listbox with some dummy values just to demonstrate how this all works. Use the cellCheck property to set the initial value of each checkbox. The cellCheck property requires two parameters: a row and a column (just like the Cell property). Stick the following code in the Open event of Listbox1.

To find out if a checkbox is checked or not, all you have to do is look at the Boolean value of cellCheck. Place the following code in the Action event of PushButton1. It loops through each row in the Listbox and grabs that row's name column if its checkbox is checked.

That's all there is to it. Run the project and click some of the chechboxes in the Listbox. Then, click the Pushbutton to see what happens. Simple, eh? Here's what the final result looks like:

5-30-03_img2.jpg (26k)

Conclusion
You can download the code for this week's project here. See you next week!




Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement. [an error occurred while processing this directive]