OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 100, "EventType()")
CreateGadgetList(WindowID(0))
ListViewGadget(0, 5, 5, 90, 90)
For i = 0 To 5
AddGadgetItem(0, -1, "item no"+Str(i))
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow : Break
Case #PB_Event_Gadget
If EventGadget() = 0
Select EventType()
Case #PB_EventType_LeftClick : Debug "LeftClick" ; This works
Case #PB_EventType_RightClick : Debug "RightClick" ; This unfortunately not
EndSelect
EndIf
EndSelect
ForEver
#LB_ITEMFROMPOINT = $1A9
If OpenWindow(0,0,0,290,200,"", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ListViewGadget(0,20,35,250,120)
For a=1 To 12
AddGadgetItem (0,-1,"Item "+Str(a)+" of the Listview")
Next
SetGadgetState(0,9)
EndIf
Repeat
Event = WaitWindowEvent()
If Event = #WM_RBUTTONDOWN
GetCursorPos_(@cursor_pos.POINT)
ScreenToClient_(GadgetID(0),@cursor_pos)
cpos = cursor_pos\x + cursor_pos\y << 16 ; x AND y are passed as lparam
itemNum = SendMessage_(GadgetID(0), #LB_ITEMFROMPOINT, 0, cpos)
If itemNum <= CountGadgetItems(0)-1 ; itemNum is zero based
SetGadgetState(0, itemNum)
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
End
It's pretty code.. and it works. Good thing I checked here after 4 hours
of trying to make it work that 'pb' way. Hope this is something on the
fix-list.