Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Locked up while updating.
#1
I have a simple dialog that updates the information in an .html file and then uploads the file using an ftp using an button.

While the function is uploading to the site, the whole dialog is locked out for a long time. I would like to know how to run the threads separately so while the html file is uploading, a user can still continue to edit text in the dialog.

I was using a file change trigger in QM for the ftp upload. That did what I wanted to break the program into two independent processes, but I want to have this all run as an executable file.

Thanks,
jimmy Vig
#2
Function Dialog82
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "4"
str rea4
if(!ShowDialog("Dialog82" &Dialog82 &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 8 8 48 14 "Upload"
;4 RichEdit20A 0x54233044 0x200 2 30 96 48 ""
;5 Static 0x54000000 0x0 78 8 48 12 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030108 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,_s="Uploading..."; _s.setwintext(id(5 hDlg))
,opt waitmsg 1 ;;process messages while waiting
,wait 0 H mac("Function168") ;;run Function168 in separate thread and wait
,_s=""; _s.setwintext(id(5 hDlg))
,case IDOK
,case IDCANCEL
ret 1

Function Function168
Code:
Copy      Help
wait 5 ;;wait 5 s. Don't process messages.
#3
That's Exactly what I wanted. Your the best G!

I set it up so the text in the button changes to "Uploading..." while it is working and then back to "Upload" after it is done.

Is there anyway to disable the button while it is working to avoid multiple uploads?

Thanks,
Jimmy Vig
#4
EnableWindow id(x hDlg) 0
#5
Perfect.

Man, I seriously learn so much from you.

I owe you a big donation one of these days Smile
#6
I have a dialog that has a button that runs this code:
Code:
Copy      Help
,case 3;;run remote function
,EnableWindow id(3 hDlg) 0
,net(computer password "function" str'retval)
,EnableWindow id(3 hDlg) 1

While the net function is running the dialog goes "Not Responding"

How do I avoid this? I did try putting the net into a separate function and run with wait 0 H mac("net_function") but the same thing happens with "Not Responding"

-Jim
#7
Like always in similar cases. Call net from function running in other thread.

case 3
mac "function_that_calls_net"


or


case 3
opt waitmsg 1
wait 0 H mac("function_that_calls_net")
#8
Shoot, missed "opt waitmsg 1" in the script.

My bad.

-Jim


Forum Jump:


Users browsing this thread: 1 Guest(s)