Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Trouble
#1
I have searched the forum and read a few topics about this
My dialog wont close when i hit the red X at the top
but also, it still wont close when i hit the OK button
I have tried doing what the other topics suggest but i still cant get it to close
I would really appreciate if someone could take a look at this dialog code and try to help me make it close when i press the red X
I have QM 2.3.0


New Code is Posted Below


Thanks very much
#2
I get an error when I try to run this macro, would you mind reposting with correct code for the forum? Just highlight all text in your function dialog and then right click --> Other Formats --> Copy for QM Forum. Then paste it in here.
Taking on Quick Macros one day at a time
#3
Ok here is the new code

Function Function
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

GdiObject- brush=CreateSolidBrush(ColorFromRGB(0 0 0))

str controls = "3 4"
str ax3SHD rea4
if(!ShowDialog("Function" &Function &controls)) ret

;BEGIN DIALOG
;0 "" 0x90CA0A44 0x100 0 0 346 270 "Instructions"
;3 ActiveX 0x54030000 0x0 4 4 176 237 "SHDocVw.WebBrowser"
;5 Static 0x54000000 0x0 230 10 80 8 "Please Read Instructions"
;6 Static 0x54000000 0x0 300 258 42 8 "Boyonmoped"
;4 RichEdit20A 0x54233044 0x200 196 28 146 194 ""
;8 msctls_progress32 0x54030000 0x0 4 246 148 21 ""
;9 Static 0x54000000 0x0 158 252 22 8 ""
;1 Button 0x54030001 0x0 196 230 146 22 "Close Instructions"
;7 Static 0x54000011 0x20000 188 8 1 257 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages

int range=116
int step=1
int timerperiod=17 ;;should be >=50

int- ti
int hpb=id(8 hDlg)

str s
str ss = "100 %"

sel message
,case WM_CTLCOLORDLG ret brush
,case WM_CTLCOLORSTATIC ret brush
,case WM_CTLCOLORLISTBOX

,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,hid id(4 hDlg)
,hid id(4 hDlg)
,hid id(5 hDlg)
,hid id(1 hDlg)
,SetTimer hDlg 1 timerperiod 0
,ret 1

,case WM_TIMER
,ti+step
,SendMessage hpb PBM_SETPOS ti 0
,if(ti<range)
,,s.format("%i %%" 100*ti/range+1)
,else
,,0.5
,,KillTimer hDlg 1
,,hid- id(4 hDlg)
,,hid- id(5 hDlg)
,,hid- id(1 hDlg)
,,hid id(8 hDlg)
,,ss.setwintext(id(9 hDlg))

,s.setwintext(id(9 hDlg))
ret
;messages2
sel wParam
,case IDOK
,DT_Ok hDlg
,case IDCANCEL
ret 1
#4
Function Function
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

GdiObject- brush=CreateSolidBrush(ColorFromRGB(0 0 0))

str controls = "3 4"
str ax3SHD rea4
if(!ShowDialog("Function" &Function &controls)) ret



;BEGIN DIALOG
;0 "" 0x90CA0A44 0x100 0 0 346 270 "Instructions"
;3 ActiveX 0x54030000 0x0 4 4 176 237 "SHDocVw.WebBrowser"
;5 Static 0x54000000 0x0 230 10 80 8 "Please Read Instructions"
;6 Static 0x54000000 0x0 300 258 42 8 "Boyonmoped"
;4 RichEdit20A 0x54233044 0x200 196 28 146 194 ""
;8 msctls_progress32 0x54030000 0x0 4 246 148 21 ""
;9 Static 0x54000000 0x0 158 252 22 8 ""
;1 Button 0x54030001 0x4 196 230 146 22 "Close Instructions"
;7 Static 0x54000011 0x20000 188 8 1 257 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages

int range=116
int step=1
int timerperiod=17 ;;should be >=50

int- ti
int hpb=id(8 hDlg)

str s
str ss = "100 %"

sel message
,case WM_CTLCOLORDLG ret brush
,case WM_CTLCOLORSTATIC ret brush
,case WM_CTLCOLORLISTBOX
,case WM_INITDIALOG
,;DT_Init(hDlg lParam);; This will prevent the Dialog to close with the X.
,hid id(4 hDlg)
,hid id(4 hDlg)
,hid id(5 hDlg)
,hid id(1 hDlg)
,SetTimer hDlg 1 timerperiod 0
,ret 1

,case WM_TIMER
,ti+step
,SendMessage hpb PBM_SETPOS ti 0
,if(ti<range)
,,s.format("%i %%" 100*ti/range+1)
,else
,,0.5
,,KillTimer hDlg 1
,,hid- id(4 hDlg)
,,hid- id(5 hDlg)
,,hid- id(1 hDlg)
,,hid id(8 hDlg)
,,ss.setwintext(id(9 hDlg))
,s.setwintext(id(9 hDlg))
,case WM_COMMAND goto messages2;;This will allow the Dialog to Close with "Close Instructions" button
ret
;messages2
sel wParam
,case IDOK
,DT_Ok hDlg
,case IDCANCEL
ret 1
Taking on Quick Macros one day at a time
#5
TYVM but is there a way to make the X start working again?
#6
In the dialog I posted, the X will work, as long as DT_Init(hDlg lParam) isn't in effect(which is why I used ; to keep it there to show you but it isn't in effect right now.) Without the ; before DT_Init(hDlg lParam), I couldn't get the X to work.

My Conclusion: Remove DT_Init(hDlg lParam) and the X will work.
Taking on Quick Macros one day at a time
#7
Thanks You

I dont know what the DT_INIT does anyway

it was in the example given to me
#8
DT_Init
function hDlg lParam

Initializes dialog.
Called implicitly on WM_INITDIALOG, before calling dialog procedure.
Taking on Quick Macros one day at a time


Forum Jump:


Users browsing this thread: 1 Guest(s)