New topic: Listbox/Checkbox Help needed
<http://forums.realsoftware.com/viewtopic.php?t=46172> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message jerryab Post subject: Listbox/Checkbox Help neededPosted: Fri Dec 07, 2012 8:15 pm Joined: Mon Dec 12, 2011 7:25 pm Posts: 133 Location: Grand Rapids MI Area I'm trying to create an email distribution list. I have a listbox with 6 columns. The first 3 are checkboxes then Name then email address and EMID number. Then there are 3 text fields that will get the information from column 4 of the listbox(the email address). What I am trying to do is check one of the checkboxes and have that information go to the correct text field and add,append or remove it depending on the state of the checkboxs. Column header is.................T C B Name Email EMID Example: Listbox is like this > [ ] [ ] [ ] Name EmailAddress EMID ...................................[ ] [ ] [ ] Name EmailAddress EMID ...................................[ ] [ ] [ ] Name EmailAddress EMID then 3 text fields called To: Cc: Bcc: When a user clicks on the first checkbox the remaining 2 need to be unchecked so at any given time only one checkbox can be selected in a row. If any one is check the remaining 2 must be unchecked. What I have tried is shown below but I know it's not right. Can anyone help me with this ? Dim i As Integer For i = 0 to me.ListCount - 1 //Indexes are zero-based if me.Selected( i ) then if me.CellCheck(i, 0) = False then me.CellCheck(i, 0) = True me.CellCheck(i, 1) = False me.CellCheck(i, 2) = False else if me.CellCheck(i, 1) = False then me.CellCheck(i, 1) = True me.CellCheck(i, 0) = False me.CellCheck(i, 2) = False else if me.CellCheck(i, 2) = False then me.CellCheck(i, 2) = True me.CellCheck(i, 0) = False me.CellCheck(i, 1) = False end end if end if else if me.CellCheck(i, 0) = True Then me.CellCheck(i, 0) = False me.CellCheck(i, 1) = False me.CellCheck(i, 2) = False else if me.CellCheck(i, 1) = True Then me.CellCheck(i, 1) = False me.CellCheck(i, 0) = False me.CellCheck(i, 2) = False else if me.CellCheck(i, 2) = True Then me.CellCheck(i, 2) = False me.CellCheck(i, 0) = False me.CellCheck(i, 1) = False end if end if end if end if me.Selected(i)=False Next _________________ iMac 27" (2.8GHz Intel Core i5, 16GB RAM, 1TB Drive) OS X Lion 10.7.3 and Windows 7 Toshiba Laptop Running Windows 7 & WinXP SP3 REAL Studio Enterprise Edition 2012r1 http://www.theultimatecampgroundlog.com Being rewritten for the Mac Top doofus Post subject: Re: Listbox/Checkbox Help neededPosted: Fri Dec 07, 2012 9:08 pm Joined: Thu Sep 10, 2009 2:50 am Posts: 315 Location: Santa Cruz, CA, USA When you toggle a Checkbox by clicking the CellAction event fires, along with the row and column it happened at. Other things can trigger CellAction so the column value is tested first... Sub CellAction(row As Integer, column As Integer) if column >= 0 and column <= 2 then //CheckBox has been toggled by click if me.CellCheck(row, column) then //this CheckBox was turned on, so turn off others for c As integer = 0 to 2 if c <> column then me.CellCheck(row, c) = false next end end End Sub Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
