01-04-2021, 10:30 PM
for drag and drop text need this member function
Member function QMDRAGDROPINFO.GetText
to create a member function. On Qm main window click file->New->New Member Function name it
QMDRAGDROPINFO.GetText
just like its written then copy code here and paste code in this member function.
an example with your dialog
Function DialogDragDropTextExample
Member function QMDRAGDROPINFO.GetText
function! str&s [flags] ;;flags: 1 drag source must not delete text
;Extracts dropped text.
;Returns 1 if successful, 0 if failed.
s.fix(0)
int k=GetMod
sel(k) case [0,2] case else this.effect=DROPEFFECT_NONE; ret
if(flags&1) k=2
int i
for(i 0 this.formats.len) if(this.formats[i].cfFormat=CF_UNICODETEXT) break
if(i=this.formats.len) ret
STGMEDIUM sm
this.dataObj.GetData(&this.formats[i] &sm); err ret
int gs=GlobalSize(sm.hGlobal)-2; if(gs<=0) ret
s.all(gs 2)
byte* m=GlobalLock(sm.hGlobal); if(!m) ret
memcpy s m s.len
GlobalUnlock sm.hGlobal
ReleaseStgMedium(&sm)
s.ansi
sel k
,case 0 this.effect&DROPEFFECT_MOVE
,case 2 this.effect&DROPEFFECT_COPY
ret 1
to create a member function. On Qm main window click file->New->New Member Function name it
QMDRAGDROPINFO.GetText
just like its written then copy code here and paste code in this member function.
an example with your dialog
Function DialogDragDropTextExample
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 8 8 96 12 ""
;4 Edit 0x54030080 0x200 8 28 96 13 ""
;5 Edit 0x54030080 0x200 8 48 96 12 ""
;6 Edit 0x54030080 0x200 8 68 96 13 ""
;7 Edit 0x54030080 0x200 8 88 96 12 ""
;8 Edit 0x54030080 0x200 120 8 96 12 ""
;9 Edit 0x54030080 0x200 120 28 96 13 ""
;10 Edit 0x54030080 0x200 120 48 96 12 ""
;11 Edit 0x54030080 0x200 120 68 96 13 ""
;12 Edit 0x54030080 0x200 120 88 96 12 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""
str controls = "3 4 5 6 7 8 9 10 11 12"
str e3 e4 e5 e6 e7 e8 e9 e10 e11 e12
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
out e3
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,QmRegisterDropTarget(id(3 hDlg) hDlg 0)
,QmRegisterDropTarget(id(4 hDlg) hDlg 0)
,QmRegisterDropTarget(id(5 hDlg) hDlg 0)
,QmRegisterDropTarget(id(6 hDlg) hDlg 0)
,QmRegisterDropTarget(id(7 hDlg) hDlg 0)
,QmRegisterDropTarget(id(8 hDlg) hDlg 0)
,QmRegisterDropTarget(id(9 hDlg) hDlg 0)
,QmRegisterDropTarget(id(10 hDlg) hDlg 0)
,QmRegisterDropTarget(id(11 hDlg) hDlg 0)
,QmRegisterDropTarget(id(12 hDlg) hDlg 0)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_QM_DRAGDROP
,QMDRAGDROPINFO& di=+lParam
,sel wParam
,,case 3 ;;drop
,,str s
,,if(!di.GetText(s)) ret
,,s.setwintext(di.hwndTarget)
,,ret DT_Ret(hDlg 1)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1