03-15-2019, 10:48 PM
Is it possible to output the rownumber of the rightclicked item on a listbox?
Currently I use Acc a.FromMouse to get the name, but I need the row.
Because the row is associated with a icsv from which I pull the correct corresponding data.
In the below code you see "aaaa" and "cccc" twice but they contain different data in their corresponding row in the ICSV.
I looked trough all the member functions of "Acc a" (CbSelect, Name, Value,...) but I couldn't find a way.
Also if this request might take to much time to implement a solution on, then please skip it. I do not want to distract you (or anyone else).
Function right_click_listbox
Currently I use Acc a.FromMouse to get the name, but I need the row.
Because the row is associated with a icsv from which I pull the correct corresponding data.
In the below code you see "aaaa" and "cccc" twice but they contain different data in their corresponding row in the ICSV.
I looked trough all the member functions of "Acc a" (CbSelect, Name, Value,...) but I couldn't find a way.
Also if this request might take to much time to implement a solution on, then please skip it. I do not want to distract you (or anyone else).
Function right_click_listbox
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 ListBox 0x54230101 0x200 7 7 94 118 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040601 "*" "" "" ""
str controls = "3"
str lb3
lb3=
;aaaa
;cccc
;aaaa
;cccc
;ffff
;gggg
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,,int lb=id(3 hDlg)
,,SetWindowSubclass(lb &sub.WndProc_Subclass_lbtest 1 0)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#sub WndProc_Subclass_lbtest ;;menu File -> New -> Templates -> Wndproc -> WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData
sel message
,case WM_RBUTTONUP
,,Acc a.FromMouse
,,str tagged_item=a.Name
,,out tagged_item ;; <============================ is it possible to output ROW NUMBER on RIGHT click?
int R=DefSubclassProc(hwnd message wParam lParam)
sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass_lbtest uIdSubclass)
ret R