Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multipage dialog, start other page number when testing
#1
I converted 2 separate dialogboxes (macros) to one multi-page dialog box containing 2 pages (0 and 1).
The conversion seems to work, but I do not know how to directly start the dialog in page '1' (second page) when I am in a function (for quick testing purposes).

The dialog structure is like follows, the bold parts the exact foldernames as in my project:

--- kboot => main folder
|
|----kboot_MAIN (when started, it shows content of 'S1', first page)
|
|----S1
|
|----s2

The folder "kboot_MAIN" contains 2 items
- one macro: 'kboot_multi_DialogBox_init'
- one function: 'kpboot_multi_DialogBox_initMainDialog' that is called from 'kboot_multi_DialogBox_init'

'kpboot_multi_DialogBox_initMainDialog' contains

BEGIN DIALOG
0 "" 0x90C80AC8 0x0 0 0 352 408 "Dialog"
...etc...

The folder 'S1' contains everything for page 0 (first page)
The folder 'S2' contains everything for page 1 (second page)

When I am working on a function in 'S2', I want to start that 'page 1' (second page) when I press the run button.

Is there a way to achieve this?
I did this in one-page dialogs by adding something like this in the top of the function " \Dialog_Editor" (Dialog_Editor, replaced by desired mac/function).
If I use that method, I would put "\kpboot_multi_DialogBox_init" in the top of the function but that starts in page 0 (first page).
#2
Function SelCurrentQmFolder
Code:
Copy      Help
;/
function# $folders

;Finds in which of specified QM folders is currently open in editor QM item.
;Returns 1-based index of string in the folders list.
;Returns 0 if current item is not in one of specified folders.

;folders - multiline list of QM folder names.

;REMARKS
;Unavailable in exe.

;EXAMPLE
;int i=SelCurrentQmFolder("Folder A[]Folder B")
;out i ;;1 if current open macro is in folder "Folder A", 2 if in "Folder B", else 0


;get ancestor folder names
ARRAY(str) a
QMITEM q
qmitem "" 0 q 16
rep
,if(!q.folderid) break
,qmitem q.folderid 0 q 17
,a[]=q.name
;out a

str s; int i R
foreach s folders
,R+1
,for(i 0 a.len) if(s~a[i]) ret R

Let the dialog call this function on WM_INITDIALOG, and select page.
Example.
Function Dialog139
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str lb3
lb3="Page0[]Page1[]Page2"
if(!ShowDialog("Dialog139" &Dialog139 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 265 163 "Dialog"
;3 ListBox 0x54230101 0x204 4 4 96 80 ""
;1001 Static 0x54020000 0x4 106 4 48 13 "Page0"
;1101 Static 0x54020000 0x4 106 4 48 13 "Page1"
;1201 Static 0x54020000 0x4 106 4 48 13 "Page2"
;1 Button 0x54030001 0x4 142 146 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 146 18 14 "?"
;5 Static 0x54000010 0x20004 0 138 800 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030606 "" "0" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,int page
#if !EXE
,page=SelCurrentQmFolder("S1[]S2")-1
#endif
,LB_SelectItem id(3 hDlg) page
,DT_Page hDlg page
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3
,_i=LB_SelectedItem(id(3 hDlg))
,DT_Page hDlg _i
ret 1
A function or macro in folder S1 or S2.
Code:
Copy      Help
;/Dialog139
;...
#3
thank you!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)