Posts: 863
Threads: 197
Joined: Apr 2005
I tried
Function test1
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str qmg3x
if(!ShowDialog("test1" &test1 &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 QM_Grid 0x56031041 0x0 4 6 204 68 "0x0,0,0,0,0x0[]A,,,[]B,,,"
;4 Button 0x54032000 0x0 16 88 48 14 "Init"
;END DIALOG
;DIALOG EDITOR: "" 0x2030207 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DlgGrid- g.Init(hDlg 3)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,test2 0
,test2 1
,case IDOK
,case IDCANCEL
ret 1
Function test2
function row
int hwnd=id(3 win("Dialog" "#32770"))
DlgGrid g.Init(hwnd)
int i
for i 0 30
,_s=i
,g.CellSet(row 0 _s)
,1
but doesn't work.
How can run (test2 0) and then (test2 1)?
Posts: 12,141
Threads: 143
Joined: Dec 2002
Avoid waiting in dialog function.
Instead use SetTimer.
But if need to wait, before insert
opt waitmsg 1
Posts: 863
Threads: 197
Joined: Apr 2005
Posts: 863
Threads: 197
Joined: Apr 2005
How can I add qmgrid.dll to exe, extract dll to temp folder?
Posts: 12,141
Threads: 143
Joined: Dec 2002
Usually nobody adds dlls to exes. Add both to a zip.
Posts: 863
Threads: 197
Joined: Apr 2005
Posts: 12,141
Threads: 143
Joined: Dec 2002
Look in Help -> #exe -> Example.
Also will need to call LoadLibrary.
Posts: 12,141
Threads: 143
Joined: Dec 2002
somewhere before showing dialog
Function test1
#if EXE
#exe addfile "$qm$\qmgrid.dll" 10 ;;add dll to exe (when making exe)
if !GetModuleHandle("qmgrid.dll")
,str sg.expandpath("$temp$\qmgrid.dll")
,if(!ExeExtractFile(10 sg)) ret ;;extract dll from exe
,if(!LoadLibrary(sg)) ret ;;load explicitly
#endif
Posts: 863
Threads: 197
Joined: Apr 2005
Posts: 12,141
Threads: 143
Joined: Dec 2002
this is with version control
Function test1
#if EXE
#exe addfile "$qm$\qmgrid.dll" 10 ;;add dll to exe (when making exe)
if !GetModuleHandle("qmgrid.dll")
,str sDir.expandpath(F"$temp$\qm\0x{QMVER}") sDll.from(sDir "\qmgrid.dll")
,if !dir(sDll) ;;if qmgrid.dll of this QM version is not already there
,,if(!ExeExtractFile(10 sDll)) ret ;;extract dll from exe; also creates folders.
,if(!LoadLibrary(sDll)) ret ;;load explicitly
#endif
Posts: 863
Threads: 197
Joined: Apr 2005
Is possible add SetProgressDialog (or similar function) in qmgrid or in dialog with qmgrid?
Posts: 12,141
Threads: 143
Joined: Dec 2002
Progress while loading data into grid? What code you use if it is so slow?
Posts: 863
Threads: 197
Joined: Apr 2005
No,
I'm downloading files and show the result in qmgrid...
file - status
aa.zip - download complete
bb.zip - downloading
...
Posts: 12,141
Threads: 143
Joined: Dec 2002
Use SetProgressCallback. Let your callback function update progress bar in dialog.
Posts: 12,141
Threads: 143
Joined: Dec 2002
Function dlg_download_progress
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("dlg_download_progress" &dlg_download_progress 0)) 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"
;7 msctls_progress32 0x54000000 0x4 4 28 186 13 ""
;3 Button 0x54032000 0x0 2 4 48 14 "Download"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,;better if this code was in other thread, but for simplicity just add flag 32
,Http h.Connect("www.quickmacros.com")
,h.SetProgressCallback(&DDP_progress id(7 hDlg))
,h.Get("test\file_1MB.txt" _s 32)
,
,case IDOK
,case IDCANCEL
ret 1
Function DDP_progress
function# nbAll nbRead str&s fparam
SendMessage fparam PBM_SETPOS iif(nbAll>0 MulDiv(nbRead 100 nbAll) 0) 0
Posts: 863
Threads: 197
Joined: Apr 2005
Posts: 12,141
Threads: 143
Joined: Dec 2002
with grid control
Function dlg_download_progress_grid
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "4"
str qmg4x
qmg4x="test\file_1MB.txt"
if(!ShowDialog("dlg_download_progress_grid" &dlg_download_progress_grid &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 Button 0x54032000 0x0 2 4 48 14 "Download"
;4 QM_Grid 0x56031041 0x0 4 46 216 66 "0x0,0,0,0,0x0[]File,,,[]Status,,7,"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,;better if this code was in other thread, but for simplicity just add flag 32
,Http h.Connect("www.quickmacros.com")
,h.SetProgressCallback(&DDP_progress_grid hDlg)
,h.Get("test\file_1MB.txt" _s 32)
,
,case IDOK
,case IDCANCEL
ret 1
Function DDP_progress_grid
function# nbAll nbRead str&s hDlg
DlgGrid g.Init(hDlg 4)
if nbRead=nbAll
,g.CellSet(0 1 "downloaded")
else
,int p=iif(nbAll>0 MulDiv(nbRead 100 nbAll) 0)
,g.CellSet(0 1 F"{p} %")
Posts: 863
Threads: 197
Joined: Apr 2005
I tried
- function a (with qmgrid)
- function b (run download with SetProgressCallback(&test_DDP_progress) and opt waitmsg 1)
Function test_DDP_progress
function# nbAll nbRead str&s fila
opt waitmsg 1
int w1=id(3 win("testd" "#32770"))
DlgGrid h.Init(w1)
if nbRead=nbAll
,h.CellSet(fila 2 "downloaded")
else
,int p=iif(nbAll>0 MulDiv(nbRead 100 nbAll) 0)
,h.CellSet(fila 2 F"{p} %")
but opt waitmsg 1 doesn't work.
any solution?
Posts: 12,141
Threads: 143
Joined: Dec 2002
Why is opt waitmsg 1 here? Itself it does nothing. It just tells wait to process messages.
I don't know what does not work here. Use out to see maybe some values are wrong.
Posts: 863
Threads: 197
Joined: Apr 2005
I found the problem: I was using SetProgressCallback with PostFormData to download a file and not updated the qmgrid...
with h.Post works.
Thanks.
|