Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Let all editbox support drag and drop files and texts
#12
It's probably best in this situation to switch to a multiline edit control
then enter wont close dialog.

But for future reference to prevent dialog from closing when enter key is pressed
find IDOK and add code
Code:
Copy      Help
,ifk(Y)          ;; Enter
,,ret 0
so it looks like this
Code:
Copy      Help
,case IDOK
,ifk(Y)          ;; Enter
,,ret 0

for the text erase problem  change
Code:
Copy      Help
,,s.setwintext(di.hwndTarget)
to
Code:
Copy      Help
,,s.setsel(0 di.hwndTarget)

for multiline edit control 

use this code
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 352 220 "Dialog" "4"
;3 Edit 0x54231044 0x200 12 8 330 180""
;1 Button 0x54030001 0x4 244 196 48 14 "OK"
;2 Button 0x54030000 0x4 300 196 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3"
str e3
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)
,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 1)) s=di.files ;;
,,s.setsel(0 di.hwndTarget)
,,ret DT_Ret(hDlg 1)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread
RE: Let all editbox support drag and drop files and texts - by Kevin - 01-16-2021, 05:07 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)