Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
edit and listbox drag and drop features
#1
Hi,
I want both the edit box and the list box to have drag and drop features
The following code:
There is no way to tell by the ID that wParam gets. The control ID is always 3, How to solve this problem?


Function Fun2
Code:
Copy      Help
out
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 136 136 "Dialog" "4"
;3 ListBox 0x54230101 0x200 8 8 120 84 ""
;4 Edit 0x54030080 0x200 8 100 120 13 ""
;1 Button 0x54030001 0x4 16 120 48 14 "OK"
;2 Button 0x54030000 0x4 72 120 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3 4"
str lb3 e4
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,QmRegisterDropTarget(id(3 hDlg) hDlg 16)
,QmRegisterDropTarget(id(4 hDlg) hDlg 16)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_QM_DRAGDROP
,QMDRAGDROPINFO& di=+lParam
,sel wParam
,,case 3
,,foreach _s di.files
,,,LB_Add(di.hwndTarget _s)
,,case 4
,,_s=di.files
,,_s.setsel(0 di.hwndTarget)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
Change the sel wparam line.

Code:
Copy      Help
,sel GetDlgCtrlID(di.hwndTarget)
#3
Thanks for your help

Is there an easy way to add list items that automatically ignore already existing items?
[Image: 1672272673]
#4
change case 3 to this
 
Code:
Copy      Help
,,case 3
,,foreach _s di.files
,,,if(LB_FindItem(di.hwndTarget _s)=-1)
,,,,LB_Add(di.hwndTarget _s)
#5
Thanks for your help


Forum Jump:


Users browsing this thread: 1 Guest(s)