Introduction to CMac: 12.7 DIALOG BOXES: Tab Bars
Tab Bars
Ain't got much to say as Tab Bars and Tree Bars are still at the fringe of my knowledge. But I do have this general outline and image showing how the Search dialog fits together.
Creating Tabbed Dialog
in Search.s…
Search → SearchTabDlg → case 0 : → call _BuildCtrls
_BuildCtrls: DlgCreate( Dlg ) DlgAddCtrl( dlg_TabBar ) DlgAddCtrl( Dlg, dlg_SubDlg, "Find", DlgAddCtrl( Dlg, dlg_SubDlg, "Find", "/BM=_SearchDlg //SM=0" DlgAddCtrl( Dlg, dlg_SubDlg, "Replace", "/BM=_SearchDlg //SM=1" DlgAddCtrl( Dlg, dlg_SubDlg, "File find", "/BM=_FileSearchDlg //SM=0" DlgAddCtrl( Dlg, dlg_SubDlg, "File replace", "/BM=_FileSearchDlg //SM=1" DlgAddCtrl( Dlg, dlg_SubDlg, "Hilite", "/BM=_GHighlightDlg" DlgAddCtrl( Dlg, dlg_SubDlg, "Options", "/BM=SrchOptionsDlg" DlgExecute( "/HOOK=_SearchTabDlgProc", dlg_Modeless ) Return
/BM= the macro for that subdialog.
SM= Search Mode. 0 for Find, 1 for Find&Replace.
Macro Search returns with modeless dialog displayed. _SearchTabDlgProc takes care of events for that modeless dialog, until that dialog gets closed, by user doing something that invokes message wm_Destroy
=== Modeless Tabbed Dialog running
_SearchTabDlgProc mostly just forwards the message on to the child window:
<code c>
_SearchTabDlgProc(&RetVal,Window,Message,WParam,LParam,Parms)
{
switch ( Message ) {
call _SendChildMsg
PostMessage( SubDlgWin, Message, WParam, LParam )
}
return ( DlgMessageProc( RetVal, Window, Message, WParam, LParam, Parms ) );
}
</code>
=== Closing Modeless Dialog
<code c>
_SearchTabDlgProc(&RetVal,Window,Message,WParam,LParam,Parms)
{
[…]
return ( DlgMessageProc( RetVal, Window, Message, WParam, LParam, Parms ) );
} |
|
Dialog.s V
DlgMessageProc
case: wm_Destroy
Exit Macro = global string: DLG_EXIT_MSTR+Str(Dlg)
RUN_MACRO( exit macro + ”/EXITDLG=1” );
DlgCleanup(Dlg,Window)
case : dlg_SubDlg
DlgKillSubDlg (dlg,
RESULT=Global_Int(_DLG_RESULT+Hex_Str(Window)), ←-return value from dialog
Parms=MStr)
DlgSetFields(dlg)
run the /BM= macro +/M=2/DLG=dlg/RES=result [“Rm( TStr +…]
Destroy_MEW_Dlg
DlgKill
run the /BM= macro +/M=3/DLG=dlg/RES=result [“Rm( TStr +…]
</code>
And I made this image attached below of the dialog pieces: