Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controlling a multipage dialog
#1
I hope that someone can help me with this. I am using a next and previous button to make your multipage dialog move 0, 1, 2 and 2, 1, 0 but the 2 page will not show. Can someone please tell me what I am doing wrong?

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

str controls = "7 8"
str o7Pre o8Nex
if(!ShowDialog("Dialog85" &Dialog85 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Static 0x54000010 0x20004 4 138 256 1 ""
;7 Button 0x54033009 0x4 68 146 56 14 "< Previous"
;8 Button 0x54003009 0x4 128 146 56 14 "Next >"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [7,8] DT_Page hDlg IsDlgButtonChecked(hDlg 8)
,case IDOK
,case IDCANCEL
ret 1
#2
Function Dialog84
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3 7 8"
str lb3 o7Pre o8Nex
lb3="Page0[]Page1[]&Page2"
if(!ShowDialog("Dialog84" &Dialog84 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;3 ListBox 0x54230101 0x204 4 4 96 80 ""
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Static 0x54000010 0x20004 4 138 256 1 ""
;7 Button 0x54033009 0x4 68 146 56 14 "< Previous"
;8 Button 0x54003009 0x4 128 146 56 14 "Next >"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,goto selectpage
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 7
,int tt = LB_SelectedItem(id(3 hDlg))
,tt-1
,LB_SelectItem id(3 hDlg) tt
,DT_Page hDlg tt
,case 8
,int t = LB_SelectedItem(id(3 hDlg))
,t+1
,LB_SelectItem id(3 hDlg) t
,DT_Page hDlg t
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3
,;selectpage
,_i=LB_SelectedItem(id(3 hDlg))
,DT_Page hDlg 0 _i
ret 1

something like this?
#3
Sorry but I need to be able to at any time select next or previous and have it take me to 0, 1, 2 or 2, 1, 0 and always work assuming that there is indeed a next or previous page and I do not want a list box.

Example:
I am on page 1 and I press the next button so I go to page 2

Or
I am on page 2 and I press previous and I am on page 1 then I press next and I am on page 2.
#4
Function Dialog84
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "7 8"
str o7Pre o8Nex

if(!ShowDialog("Dialog84" &Dialog84 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Static 0x54000010 0x20004 4 138 253 1 ""
;7 Button 0x54033004 0x4 68 146 56 14 "< Previous"
;8 Button 0x54003004 0x4 128 146 56 14 "Next >"
;END DIALOG
;DIALOG EDITOR: "" 0x2030002 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,EnableWindow(id(7 hDlg)0)
,int+ t = 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 8
,EnableWindow(id(7 hDlg)1)
,t+1
,if(t = 2)
,,EnableWindow(id(8 hDlg)0)
,DT_Page(hDlg t)
,
,case 7
,EnableWindow(id(8 hDlg)1)
,t-1
,if(t = 0)
,,EnableWindow(id(7 hDlg)0)
,DT_Page(hDlg t)
,case IDOK
,case IDCANCEL

ret 1

how about now?
#5
WOW and WOW that is perfect and it answers another question!

Added:
another WOW I did not know global variables worked that way.
#6
Replace
int+ t = 0
to
Code:
Copy      Help
,int-- t; t = 0
#7
Can someone tell me why the information for the 3rd page appears on the 1st page when you start the macro and then after you press next everything is corrected?

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

str controls = "5 6 1208"
str o5Pre o6Nex e1208
if(!ShowDialog("My_Dialog87" &My_Dialog87 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Button 0x54033004 0x4 68 146 56 14 "< Previous"
;6 Button 0x54003004 0x4 128 146 56 14 "Next >"
;1208 Edit 0x54030080 0x200 16 64 96 14 ""
;1209 Static 0x54000000 0x0 24 88 48 12 "Text"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,EnableWindow(id(5 hDlg)0)
,int-- t; t = 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,EnableWindow(id(5 hDlg)1)
,t+1
,if(t = 2)
,,EnableWindow(id(6 hDlg)0)
,DT_Page(hDlg t)
,
,case 5
,EnableWindow(id(6 hDlg)1)
,t-1
,if(t = 0)
,,EnableWindow(id(5 hDlg)0)
,DT_Page(hDlg t)
,case IDOK
,case IDCANCEL

ret 1
#8
3-rd page was selected in dialog editor.
#9
Sorry I just do not see it. I change everything that I can include 1208 to 1108 and it still is there when you start the macro.

Added:
It says that it is Page 0
#10
The correct answer is:
After case WM_INITDIALOG, insert

,DT_Page(hDlg 0)

Without it all controls in all pages are visible. DT_Page hides controls in other pages.
#11
How dumb can I be.

Thank You
#12
I would like the Nest and Previous buttons to be on the Zero and the One page but not the Two page. I am not sure of the best way to do this. I do not want to take away any of the control of the Nest and Previous buttons and I do not want to do something like hide the buttons for the Two page because sometimes it does not hide. Every time I try to remove the Nest and Previous buttons I get an unwanted response.

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

str controls = "5 6 1208"
str o5Pre o6Nex e1208
if(!ShowDialog("My_Dialog87" &My_Dialog87 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Button 0x54033004 0x4 68 146 56 14 "< Previous"
;6 Button 0x54003004 0x4 128 146 56 14 "Next >"
;1208 Edit 0x54030080 0x200 16 64 96 14 ""
;1209 Static 0x54000000 0x0 24 88 48 12 "Text"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Page(hDlg 0)
,EnableWindow(id(5 hDlg)0)
,int-- t; t = 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,EnableWindow(id(5 hDlg)1)
,t+1
,if(t = 2)
,,EnableWindow(id(6 hDlg)0)
,DT_Page(hDlg t)
,
,case 5
,EnableWindow(id(6 hDlg)1)
,t-1
,if(t = 0)
,,EnableWindow(id(5 hDlg)0)
,DT_Page(hDlg t)
,case IDOK
,case IDCANCEL

ret 1
#13
After if(t = 2) insert

Function My_Dialog87
Code:
Copy      Help
,,hid(id(5 hDlg))
,,hid(id(6 hDlg))

Or place the buttons in a separate page, and with DT_Page use special string that shows two pages simultaneously.
Function My_Dialog87
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "1208"
str e1208
if(!ShowDialog("My_Dialog87" &My_Dialog87 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x44020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x44020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 12 144 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;2005 Button 0x54033004 0x4 68 146 56 14 "< Previous"
;2006 Button 0x54003004 0x4 128 146 56 14 "Next >"
;1208 Edit 0x54030080 0x200 16 64 96 14 ""
;1209 Static 0x54000000 0x0 24 88 48 12 "Text"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
lpstr pagemap="(0 10) (1 10) 2"
sel message
,case WM_INITDIALOG
,DT_Page(hDlg 0 pagemap)
,EnableWindow(id(5 hDlg)0)
,int-- t; t = 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 2006 ;;Next
,EnableWindow(id(5 hDlg)1)
,t+1
,if(t = 2)
,,EnableWindow(id(6 hDlg)0)
,DT_Page(hDlg t pagemap)
,
,case 2005 ;;Previous
,EnableWindow(id(6 hDlg)1)
,t-1
,if(t = 0)
,,EnableWindow(id(5 hDlg)0)
,DT_Page(hDlg t pagemap)
,case IDOK
,case IDCANCEL

ret 1
#14
I do not know how this works “Or place the buttons in a separate page, and with DT_Page use special string that shows two pages simultaneously.” But it works perfect and every time and I have something new to study.

Thank You

Added:
I do have one question why is the < Previous button now enabled when you are on the 0 Page?

Added:
I was placing the hide in the wrong place and it works fine now so if you can not get the enable/disable to work that is fine.


Forum Jump:


Users browsing this thread: 2 Guest(s)