Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SysTabControl32
#1
can you show a simple example?
#2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dialog_with_tab_control" &dialog_with_tab_control)) ret

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 265 163 "Form"
;1001 Static 0x44020000 0x4 94 60 48 13 "Page0"
;1101 Static 0x44020000 0x4 104 62 48 13 "Page1"
;1201 Static 0x44020000 0x4 110 70 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 "?"
;3 SysTabControl32 0x54000040 0x0 0 2 266 132 ""
;5 Static 0x54000010 0x20004 4 138 257 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010800 "" " "


type TCITEM mask dwState dwStateMask $pszText cchTextMax iImage lParam

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,
,int htb=id(3 hDlg)
,TCITEM ti.mask=WINAPI.TCIF_TEXT
,ti.pszText="A"
,SendMessage htb WINAPI.TCM_INSERTITEMA 0 &ti
,ti.pszText="B"
,SendMessage htb WINAPI.TCM_INSERTITEMA 1 &ti
,ti.pszText="C"
,SendMessage htb WINAPI.TCM_INSERTITEMA 2 &ti
,
,goto g11
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,_i=SendMessage(nh.hwndFrom WINAPI.TCM_GETCURSEL 0 0)
,;g11
,DT_Page hDlg _i
#3
Thanks.
#4
Hi,
I love the sample dialog with tab control. I would like to modify it so that buttons on a given page will change a display text box. Do you know how I can actively change the text box in an open dialog depending on the user choice of button?

This is how far I have gotten (see below).

Thanks!!!,
Stuart

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

str controls = "1001 1002 1003 1004 1005 1006"
str b1001Txt1 b1002Txt2Str b1003Txt3 b100Txt4 b1005Txt5 e1006Tes

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

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 387 290 "Form"
;1101 Static 0x44020000 0x4 104 62 48 13 "Page1"
;1201 Static 0x44020000 0x4 110 70 48 13 "Page2"
;1301 Static 0x44020000 0x4 94 60 48 13 "Page3"
;1401 Static 0x44020000 0x4 104 62 48 13 "Page4"
;1501 Static 0x44020000 0x4 110 70 48 13 "Page5"
;1 Button 0x54030001 0x4 142 272 48 14 "OK"
;2 Button 0x54030000 0x4 192 272 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 272 18 14 "?"
;1003 Button 0x54030000 0x0 10 22 48 14 "Text1"
;1001 Button 0x54032000 0x0 10 36 48 14 "Text2"
;1002 Button 0x54032000 0x0 10 52 48 14 "Text3"
;1004 Button 0x54032000 0x0 66 28 58 14 "Text4"
;1005 Button 0x54032000 0x0 72 46 48 14 "Text5"
;1006 Edit 0x54030080 0x200 134 20 240 235 ""
;5 Static 0x54000010 0x20004 4 264 374 1 ""
;3 SysTabControl32 0x54000040 0x0 0 2 382 260 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "0" ""


type TCITEM mask dwState dwStateMask $pszText cchTextMax iImage lParam

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,
,int htb=id(3 hDlg)
,TCITEM ti.mask=WINAPI.TCIF_TEXT
,ti.pszText="1"
,SendMessage htb WINAPI.TCM_INSERTITEMA 0 &ti
,ti.pszText="2"
,SendMessage htb WINAPI.TCM_INSERTITEMA 1 &ti
,ti.pszText="3"
,SendMessage htb WINAPI.TCM_INSERTITEMA 2 &ti
,ti.pszText="4"
,SendMessage htb WINAPI.TCM_INSERTITEMA 3 &ti
,ti.pszText="5"
,SendMessage htb WINAPI.TCM_INSERTITEMA 4 &ti
,
,goto g11
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,_i=SendMessage(nh.hwndFrom WINAPI.TCM_GETCURSEL 0 0)
,;g11
,DT_Page hDlg _i
#5
You need to add the same buttons on every page.
#6
Like this?

...
Code:
Copy      Help
;messages2
sel wParam
,case 1003
,str s="Text1"
,s.setwintext(id(1006 hDlg))
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
...
#7
Hi Gintaras,
I forget about the setwintext command. I think I am finally starting to understand dialogs a bit better - certainly the hardest part of QM for me - but now much more powerful now that I am getting the hang of it.
Thanks again,
Stuart
#8
Hi Gintaras,
Love the new look of the Forum and especially love all the new improvements in the latest Beta - fantastic job!!!!!!!

I have been trying to do some ambitious multipage (tab-controlled i.e. SysTabControl32_) dialogs based on the sample you gave in earlier in this thread:
(SysTabControl32)

Unfortunately, I am running up against the limits of how many local variable, controls or cases you can have in a dialog. For example, when I add too many cases in the "sel wParam" section, QM stops being able to find the ;g11 label at the end in the messages3 section.

I can email you an example but I think it is too long to post in forum.

I would be so grateful if you could help me. To make it easier (I hope), I have attempted to break it down to simple questions that will help me reduce the number of these items in the dialog:

1). Using the example earlier in the SysTabControl32 thread, how do you output the tab that is being displayed. If I know this I can put some redundant buttons that are currently on every page just on the master page, and then, if they are selected, have a different outcome depending on which tab was active.

2). If I simply have to have a multipage dialog with too many buttons on too many pages, is there a way to split this among several macros/functions, i.e. maybe separate functions for each page/tab?

If #2 is the better approach, rather than #2, that's ok. I have been cutting back the dialog elements down to the bare minimum but can't get back under the limit. If I could have them all back by "off-loading" to helper macros, that would be great.

Thanks,
Stuart
#9
QM does not limit the number of case. It does not find the label because it is at an offset >= 64KB. The limitation will be removed in next beta, this week.

Quote:how do you output the tab that is being displayed
Code:
Copy      Help
,_i=SendMessage(id(3 hDlg) TCM_GETCURSEL 0 0)
,out _i

----

The limit of the number of local variables (256) will still exist. Try to use an user-defined type for dialog controls. Or use multiple child dialogs, which would be the answer to the question 2.

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

if(!ShowDialog("Dialog60" &Dialog60)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x10100 0 0 221 159 "Dialog"
;1 Button 0x54030001 0x4 120 140 48 14 "OK"
;2 Button 0x54030000 0x4 170 140 48 14 "Cancel"
;3 SysTabControl32 0x54010040 0x0 0 0 222 134 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
ARRAY(int)-- tabs.create(3)
sel message
,case WM_INITDIALOG
,;add tabs to the tab control
,str st="A[]B[]C" ;;tab labels
,int i htb=id(3 hDlg); TCITEM ti.mask=TCIF_TEXT; RECT r rr
,foreach(ti.pszText st) SendMessage htb TCM_INSERTITEMA i &ti; i+1
,;calculate y of child dialogs
,GetWindowRect htb &rr; ScreenToClient hDlg +&rr
,SendMessage htb TCM_GETITEMRECT 0 &r
,i=rr.top+r.bottom+2
,;create and initialize child dialogs
,tabs[0]=Tab0(0 0 hDlg i)
,tabs[1]=Tab1(0 0 hDlg i)
,tabs[2]=Tab2(0 0 hDlg i)
,
,_i=0; goto g11 ;;select first tab
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,;get data of child dialogs
,Tab0(0 1 hDlg tabs[0])
,Tab1(0 1 hDlg tabs[1])
,Tab2(0 1 hDlg tabs[2])
,
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case TCN_SELCHANGE
,_i=SendMessage(id(3 hDlg) TCM_GETCURSEL 0 0)
,;g11
,for(i 0 tabs.len) hid tabs[i]
,hid- tabs[_i]

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

str controls = "4"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Tab0 &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10000644 0x0 0 0 187 107 ""
;3 Static 0x54000000 0x0 26 22 48 12 "A"
;4 Edit 0x54030080 0x200 26 38 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "4"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Tab1 &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10000644 0x0 0 0 187 107 ""
;3 Static 0x54000000 0x0 26 22 48 12 "B"
;4 Edit 0x54030080 0x200 26 38 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "4"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Tab2 &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10000644 0x0 0 0 187 107 ""
;3 Static 0x54000000 0x0 26 22 48 12 "C"
;4 Edit 0x54030080 0x200 26 38 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1
#10
Gintaras,
I watched Star Wars on TV last night and I realized that you are like my Jedi Master but instead of confusing cryptic mystical answers you give straightforward easy-to-understand incredibly useful answers at lightspeed. Plus you never would let anyone use QM to stray over to the Dark Side of the Force!!!!!!

Thank you again! Each example was a perfect answer to my question. Looking forward to breeaking the 64Kb limit!

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)