Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh / Change Variable in Dialog with loop
#1
Hello~ Gintaras~!

I asked how to refresh dialog last time.
I tried below (refresh dialog when Edit contents is changed) and it works but freezes 2~3 seconds.
also I wonder how to refresh dialog (or controls) with loop (1 sec cycle) without "EndThread" and "mac"

Code:
Copy      Help
str dd=
BEGIN DIALOG
0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
4 Edit 0x54030080 0x200 8 8 96 12 ""
5 Button 0x54012003 0x0 8 28 48 10 "Check"
3 Button 0x54032000 0x0 8 56 48 14 "Reload GUI"
1 Button 0x54030001 0x4 116 116 48 14 "OK"
2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
END DIALOG
DIALOG EDITOR: "" 0x2040307 "*" "" "" ""

str controls = "4 5"
str e4 c5Che
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
    case WM_INITDIALOG
    case WM_DESTROY
    case WM_COMMAND goto messages2
ret
messages2
sel wParam
    case 3 ;;Reload GUI
    DT_SetControls hDlg
    case EN_CHANGE<<16|4
    DT_SetControls hDlg
    wait 0.5
    case IDOK
    case IDCANCEL
ret 1
#2
In dialogs don't use wait, use timer.

Function Dialog213
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetTimer hDlg 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,out "refresh"
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
Oh, I didn't know WM_Timer. I'll try that.

Thank you Gintaras always for this useful tool and help.


Forum Jump:


Users browsing this thread: 1 Guest(s)