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>