How to know wich cell was double-clicked? 
Author Message
 How to know wich cell was double-clicked?
Hi!

I have a multi colomn listBox. When i double-click an item, i would like to
pass the (row,colomn) to a method.

How can i know wich cell was double-clicked?

Franck



Sat, 07 Feb 2004 04:18:31 GMT  
 How to know wich cell was double-clicked?

Quote:

> I have a multi colomn listBox. When i double-click an item, i would like to
> pass the (row,colomn) to a method.

> How can i know wich cell was double-clicked?

Try the following:

Create a property "pos as integer" in the window containing your listbox

Drag a timer to your window, the timer's mode needs to be 2-multiple
(which is the default). Set it's period to 100 (or something similar,
allowing a reasonable update of the mouse-position)

3. Put "pos=mouseX-YourListboxName.left" in the timer's action-event

4. In the DoubleClick-Event of your listbox, type

  Dim k as integer
  If pos > 0 AND pos < 60 then
    k=0
  Elseif pos > 60 AND pos < 120 then
    k=1
  Elseif pos > 120 AND pos < 180 then
    k=2
  End if
  MsgBox "I am in cell "+str(me.listIndex)+","+str(k)

This example uses a listbox with 3 columns and a width of 200 pixels,
hence (200 - scrollbar = about 180, divided by 3 = 60) the steps of 60.
You'll figure what you'll have to put in your code...

Or even better: subclass listbox and create a new event (and, of course,
the timer in code) that handles all this generically.

Cheers,

Knut



Sun, 08 Feb 2004 04:06:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. (wxPython) Double left clicking and right clicking with ListBoxes

2. Key presses, clicks and double clicks.

3. double-clicking in tk_get*File dialog generates click in the window underneath

4. Single Click binding blocks double click?

5. Selecting a row when clicking on a cell

6. Table selection on clicking on a cell

7. Order of storage of cell pairs & doubles

8. Double cell multiply in ANS Forth? D*

9. PRC: double number cell order

10. GF/ST & double Click

11. Editing In APLSE Using Double-Click

12. MoviePlayer - disable double click

 

 
Powered by phpBB® Forum Software