1. Win32Lib: mouse position on double click in list?

Can anyone tell me why I can't get mouse position info back from a
double-click in a list box?

I'm trying to use Brian's "tabbed list box", & would like to be able to
change info in a "column" by double-clicking on a column of an item, using
the position of the mouse on click as a "which column" test; but I'm getting
weird returns for the position of the mouse on double click. It's always the
same no matter where I click, unless I click in a different list, which is
always the same in that list no matter where I click, unless I exit &
restart, in which case both numbers will likely be different this time, but
still same each time click in the list. (er, in other words, each time you
enter the program, each list will return a new number, different for each
list, but it's the same number for any position in the list, instead of an
actual position).

Example follows.

Thanks,
Dan Moyer


--  CODE BEGINS
--  code generated by Win32Lib IDE v0.8

include Win32Lib.ew
without warning

----------------------------------------------------------------------------
----
--  Window Window1
global constant Window1 = create( Window, "The Window", 0, Default, Default,
524, 248+ 19, 0 )
global constant List1 = create( List, "List1", Window1, 41, 29, 150, 120,
0 )
global constant List2 = create( List, "List2", Window1, 268, 32, 150, 120,
0 )
global constant LText3 = create( LText, "LText3", Window1, 164, 208, 172,
24, 0 )
global constant LText6 = create( LText, "LText6", Window1, 4, 164, 516, 24,
0 )
----------------------------------------------------------------------------

procedure Window1_onOpen ()
addItem(List1,"something")
addItem(List2,"SOMETHING")
setText(LText6,"Double-Click on item in list box; SHOULD show x-position of
click?")
end procedure
onOpen[Window1] = routine_id("Window1_onOpen")

----------------------------------------------------------------------------
----
procedure List1_onMouse ( int event, int x, int y, int shift )
  if event = LeftDoubleClick then
    setText(LText3, sprint(x))
  end if
end procedure

onMouse[List1] = routine_id("List1_onMouse")

----------------------------------------------------------------------------
----
procedure List2_onMouse ( int event, int x, int y, int shift )
  if event = LeftDoubleClick then
    setText(LText3, sprint(x))
  end if
end procedure

onMouse[List2] = routine_id("List2_onMouse")

----------------------------------------------------------------------------

WinMain( Window1, Normal )
-- CODE ENDS

new topic     » topic index » view message » categorize

2. Re: Win32Lib: mouse position on double click in list?

Dan,

I think that win32lib is designed to respond to onChange and onMouse with
the RIGHT_DOWN event. I tested your program using RIGHT_DOWN and it
returns the proper x,y coordinates relative to the list. The only time I
have used LEFT_DOUBLECLICK is followed by a getIndex but that won't help
your problem getting into the 'column' <shrug>.

Maybe someone else knows the answer.

Judith

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu