Sometimes people would like a cell to go into edit mode as soon as the cell is clicked. If you intended to do this, then you were successful. However, I don't think you can have it respond to double-clicks at that point. If I remember correctly, when a cell goes into edit mode, you're actually dealing with an EditField. EditFields do not have double-click functionality.
Remove all of your code from the CellClick event and add this to the Open event of the ListBox: me.ColumnType(0) = 3 me.ColumnType(1) = 3 This will allow all of the cells to be editable and will also allow the rows to respond to double-clicks. It also automatically selects all of the text in the cell that has become editable, which is what you seemed to be doing in the CellClick event. This is the normal behavior. If you want to bypass this normal behavior, I think you really need to figure out a way to make the editable cell (an EditField) respond to double-clicks. I don't think this is possible, but I'm not sure. You might also check out third-party products... HTH -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Johnson Sent: Sunday, November 19, 2006 2:14 PM To: [email protected] Subject: Listbox DoubleClick event Hello everyone, I am running RB5.5 Pro on MACOSX 10.3.9. The behavior I want for my listbox is as follows: A single-click on an unselected row selects the row. A single-click on a selected row selects a cell in the row A double-click on a row (selected or not) invokes a method. The following code in the CellClick (and CellKeyDown) events accomplishes the the first two. The problem is that I am not receiving the DoubleClick event. It doesn't matter if CellCIick returns true or false, I only receive DoubleClick if there is *no* code in the CellClick event. How do I manage to receive the DoubleClick event and still handle single-clicks correctly? Here is the code: Function (CellClick(row as integer, column as Integer, x as Integer, y as Integer) as Boolean Dim i as Integer //-- If the row clicked in was not already selected, then just select the row --// if (NOT listBox1.selected(row)) then //-- Deselect all the rows --// for i = 0 to me.lastIndex listbox1.selected(i) = False next i //-- then select this row --// listBox1.selected(row) = TRUE else //-- If the row *is* already selected, then select the cell --// //-- and allow the cell to be edited --// me.editcell(row, column) //-- select the contents of the cell --// self.ListBox1.activecell.selStart = 0 self.ListBox1.activecell.SelLength = len(self.ListBox1.activecell.text) end if return false 'return true End Function ----------------------- Function CellKeyDown(row as Integer, column as Integer, key as String) As Boolean Dim returnvalue as Boolean Dim leftarrowkey As String = chr(28) Dim rightarrowkey As String = chr(29) Dim tabkey As String = chr(9) returnvalue = TRUE Select case key case leftarrowkey if (column > 0) then me.editCell(row, column - 1) end if case tabkey if (column < me.columncount - 1) then me.editCell(row, column +1) elseif (me.lastIndex > row) then me.editCell(row + 1, 0) else me.editcell(0, 0) end if case rightarrowkey if (column < me.columncount - 1) then me.editCell(row, column +1) end if else returnvalue = FALSE End Select RETURN returnvalue End Function --------------------- Sub DoubleClick() Dim i, row as Integer For i = 0 to me.lastindex if me.selected(i) then row = i end if next i MSGBox("Double-click in row " + str(row) ) End Sub Thanks in advance, David _______________________________________________ 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> _______________________________________________ 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>
