Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting DblClick Select out of a multiselect listbox
#1
Hi Gintaras,
I just saw there was a new beta version of QM 2.3.2
That's great, can't wait to check it out.

My question regards whether it's possible to get a double clicked item out of a multiselect Listbox using
case LBN_DBLCLK in a dialog.

LB_GetItemText doesn't seem to work right if there are items previously selected in the ListBox.
Basically, I want to get the doubleclicked item but retain the previously selected items as selected. The doubleclicked item can become selected if not already selected. If already selected, it shouldn't unselect.
I have been trying to do this with unselecting and reselected the initial selected items, and in between, single selecting with a lef statement (which is kind of dangerous if the user moves quickly) and getting that single selected item. But this seems to be buggy.
Any more direct method?
Thanks so much...I can give code example if this is too confusing.
Stuart
#2
does this help

Function Dialog4
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str lb3
out
lb3= "hey[]you[]there"
if(!ShowDialog("Dialog4" &Dialog4 &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ListBox 0x54230109 0x200 2 34 96 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030202 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case LBN_DBLCLK<<16|3
,int dblclickd=LB_SelectedItem(lParam)
,if(SendMessage(lParam LB_GETSEL _i 0) = 0)
,,LB_SelectItem lParam dblclickd 1
,str txt
,for _i 0 LB_GetCount(lParam)
,,if(SendMessage(lParam LB_GETSEL _i 0) = 1)
,,,LB_GetItemText lParam _i &txt
,,,out "%s is selected" txt

,case IDOK
,case IDCANCEL
ret 1
#3
thanks so much!!!
I am using now LB_GetItemText (see below) and everything seems to work great.
Stuart


function# hwndctrl item str&itemtext

Gets list box (ListBox control) item text.
Returns 1 on success, 0 on failure.
Does not work with controls that have "owner-draw" style.

hwndctrl - list box control handle.
item - 0-based item index.
itemtext - str variable that receives item text.


Forum Jump:


Users browsing this thread: 1 Guest(s)