ListBox.DoubleCLick delay betwen the two clicks ?

I started in that prject using the CellClick Event to edit the clicked Cell.

Then, I commented out the code and add the DoubleCLick Event, then put the code below.

EditMode is a Boolean set / unset by a MenuItem…

At last, I am happy (nearly) with that, but the delay between the two clicks is long, very long, can be minutes…

What’s your experience ?

[code]Sub DoubleClick()
Dim row As Integer
Dim column As Integer

// From the Language Reference…
row = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column = Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)

If EditMode Then
LB.CellType(row,column) = ListBox.TypeEditableTextField
LB.EditCell(row,column)
Else
LB.CellType(row,column) = ListBox.TypeNormal
End If
End Sub[/code]

I just checked with 2014r3 and get the same results.

I discovers that after a click to select a Row and I was feeling thirsty… After the drink (water with minth syrup), I issued a second click i the already selected line and have the Cell ready to be edited…

On 2015R2.2 (Windows 7 64bit) I am not seeing the problem. The double click timeout is no more that what see in any other app. Besides, I believe that the double click timeout is set by the system, not Xojo (correct me if I’m wrong here) so perhaps it is something in your system’s settings. Are you sure you completely eliminated all of the code in the CellClick event, including the return value?

why not simple?

If EditMode Then
LB.EditCell(row,column)
Else
return
End If

If it not returning until minutes later, something else is going on. Likely something with the Return value as Dale mention. I had a similar issue with MouseDown, this solved it:

https://forum.xojo.com/10968-listbox-mousedown-and-doubleclick-event

[quote}Are you sure you completely eliminated all of the code in the CellClick event, including the return value?[/quote}
Yes…

In fact, I commented all the code, but I can remove it (I will after a project backup)

Thank you all for your answers.

Merv,

the last test I’ve done, with 2015r3, I only run the project in the IDE, load a test file, click in a Row, wait a bit of time, click a second time in the same Row and got the last clicked Cell set as Editable (ready to be edited).

[quote=224703:@Emile Schwarz]Merv,

the last test I’ve done, with 2015r3, I only run the project in the IDE, load a test file, click in a Row, wait a bit of time, click a second time in the same Row and got the last clicked Cell set as Editable (ready to be edited).[/quote]

What is the code in MouseDown ?

[quote=224507:@Axel Schneider]why not simple?

If EditMode Then
LB.EditCell(row,column)
Else
return
End If[/quote]
Because DoubleCLick Event does not know about row,column ?

Nothing. Nada. Niente. Rien… ;-:slight_smile:

Not even added !

[code]Dim xValue As Integer
xValue = System.MouseX - Me.Left - Self.Left

Dim yValue As Integer
yValue = System.MouseY - Me.Top - Self.Top

Dim row, column As Integer
row = Me.RowFromXY(xValue, yValue)
column=Me.ColumnFromXY(xValue, yValue)

me.EditCell row, column[/code]

Hi Axel,

what’s wrong with the code taken from the Language Reference to get Row, Column (read far above) ?

nothing, but you said ‘Because DoubleCLick Event does not know about row,column’

OK. Understand.

Thank you.

[quote=224368:@Emile Schwarz]I started in that prject using the CellClick Event to edit the clicked Cell.

Then, I commented out the code and add the DoubleCLick Event, then put the code below.

EditMode is a Boolean set / unset by a MenuItem…

At last, I am happy (nearly) with that, but the delay between the two clicks is long, very long, can be minutes…

What’s your experience ?

[code]Sub DoubleClick()
Dim row As Integer
Dim column As Integer

// From the Language Reference…
row = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column = Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)

If EditMode Then
LB.CellType(row,column) = ListBox.TypeEditableTextField
LB.EditCell(row,column)
Else
LB.CellType(row,column) = ListBox.TypeNormal
End If
End Sub[/code]

I just checked with 2014r3 and get the same results.

I discovers that after a click to select a Row and I was feeling thirsty… After the drink (water with minth syrup), I issued a second click i the already selected line and have the Cell ready to be edited…[/quote]

I created a simple project with just a LB ListBox and your code into its doubleclick event. It does not do what you describe. There must be something else in your code that does what you describe.

Would be constructive if you posted a sample project demonstrating what you see.

I way not be crystal clear. So I will restate the “trouble”:

I implemented the shared code in an added DoubleClick Event in a ListBox. That seems clear.

Then, while using teh application, I noticed that sometimes, I click in an already selected Row and fall into Edit Mode. In no way, this was a double click. Two clicks were done in the same Row, but with a long delay between them, far more than what anyone can call a double click.

Michel suggest it, I will (try to) do itas soon as I can get some minutes to do that.

Thank you for reading.

I’ve got it (more or less):

Test Projectt.

The delay is not as long as it can be on my real project, but it can be around 1 second long…

You may run the standalone with the trouble from here. OS X only (sorry for the WIndows only people)

Drop a Tab + Return text file or a csv (double quoted fields + comma) on the main window,
then click to select one Row,
ctrl-E to set the Edit Mode On,
then click in the already selected Row will let you Edit the clicked Cell.

Nota: rough application (beta stage) who works fine with me, but it is with me [ ;-:slight_smile: ]. Some features are not implemented, others works only during the application run, etc.

I think I see what you’re saying, and the problem is this line

LB.CellType(row,column) = ListBox.TypeEditableTextField

That makes the cell Auto-Editable.

So as I go around double clicking cells to edit, they get changed to auto-edit and thereafter simply clicking it once when selected will start editing.

Doesn’t Axels code solve it?

[quote=224507:@Axel Schneider]why not simple?

If EditMode Then LB.EditCell(row,column) Else return End If[/quote]

Hi Will,

thank you for your answer. The line:

LB.CellType(row,column) = ListBox.TypeEditableTextField

comes from the docs ListBox.EditCell.

Nota: I got far more troubles with prior code to Edit a cell (delay to long delay before the ListBox allows the Cell to be edited) until I found that.

Axel suggestion ?
I commented the line (you said problems resides in) and so I get Axel’s suggestion (changing LB to Me…):

If EditMode Then Me.EditCell(row,column) Else Me.CellType(row,column) = ListBox.TypeNormal End If End Sub

To get the same results.

I tried your TestProject, I can not notice any delay in DoubleClick

(what I always do in OS X, is to disable the focus ring in a ListBox)

and I think

If EditMode Then LB.EditCell(row,column) End If
is enough

from LR:

The values of CellType > 0 (Default) override ColumnType.
For example, if ColumnType is 2, but a cell in the column has CellType set to 1, the cell will be normal.

You are right, I checker earlier (minutes ago).

I will try the application after I boot on El Capitan (from an external HD) later today.

Remember: what I called “delay between two clicks” is… can be… a click to select the Row, then seconds to minutes later, a second click (in the same Row) will enable the Cell Editing.

Also, the project latency between the two clicks is far less, but can be around 1 second (0.75 ?). That is why I uploaded a stand alone of the application (OS X only).