Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can WM_DROPFILES be used in a ListBox?
#6
Thanks for this example Kevin, I may be able to work with it.
Check out what I'm working with. (My example below)
The upper listbox clicking will run the function, and
the lower one, clicking will take you to the function in qm for editing.

What I'm hoping to accomplish with the drag and drop is to add another function to the existing listboxes
just with drag and drop and have the code inserted automatically, instead of editing the existing listbox with code manually.
I know I'm probably searching for the impossible, but I like a challenge.

Below: create Function100 and Function200, and Favorites_Example to understand my example.

Function Function100
Code:
Copy      Help
mes "This is Function100. Running" "Function100" "i"

Function Function200
Code:
Copy      Help
mes "This is Function200. Running" "Function200" "i"

Function Favorites_Example
Trigger Wff 0x4     Help - how to add the trigger to the macro
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CE0AC8 0x18 0 0 224 330 "Favorites_Example" "4"
;3 ListBox 0x54A30001 0x200 4 20 216 131 "Frequently Used:  (Run)"
;4 ListBox 0x54A30101 0x200 4 180 216 142 "Edit Function:"
;5 Static 0x54000000 0x0 12 8 198 12 "Run Function:"
;6 Static 0x54000000 0x0 12 168 198 12 "Edit Function:"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3 4"
str lb3Fre lb4Edi

lb3Fre="&Function100[]Function200"
lb4Edi="Function100[]&Function200"

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam


str s; int i ii;;we will use these local variables in several places. Note that local variables are created/destroyed on each message.
int-- t_initalizing t_timerCounter ;;use thread variables where need. They are destroyed when the dialog is closed and the thread ends.
str sX, sY, scx, scy 
int x y cx cy ix iy icx icy

sel message ;;Windows messages received by the dialog
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3ms 4ms"
,x = 2773
,y = -69
,cx = 353
,cy = 576
,int w=win("Favorites_Example" "#32770")
,act w
,mov+ x y cx cy w        ;;   2773 -69 353 593
,
,t_initalizing=1
,
,t_timerCounter=0
,SetTimer hDlg 10 1000 0 ;;let this dialog receive WM_TIMER messages every 1000 ms, wParam=10
,t_initalizing=0
,
,case WM_TIMER
,sel wParam
,,case 10
,,t_timerCounter+1
,,s=t_timerCounter; s.setwintext(id(3 hDlg))
,
,case WS_CAPTION
,
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
if(t_initalizing) ret 1 ;;ignore all control notifications sent while we are in WM_INITDIALOG
;;; start
sel wParam ;;messages from controls of these classes: Button, Edit, ComboBox, ListBox, Static and some other
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3
,_i=LB_SelectedItem(lParam)
,;out "ListBox1: item %i selected" _i
,if _i = 0
,,Function100()
,,;goto start
,if _i = 1
,,Function200()
,
,
,case LBN_SELCHANGE<<16|4
,_i=LB_SelectedItem(lParam)
,;out "ListBox2: item %i selected" _i
,if _i = 0
,,int wQM=win("Quick Macros" "QM_Editor")
,,act wQM; 0.13
,,'AL
,,key "Function100"
,if _i = 1
,,wQM=win("Quick Macros" "QM_Editor")
,,act wQM; 0.13
,,'AL
,,key "Function200"
,
,
,
ret 1



 


Messages In This Thread
RE: Can WM_DROPFILES be used in a ListBox? - by ScottF - 10-24-2020, 01:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)