How to create a Tabular Dialog

(1) (2) (3) (4)
 
How to create a Tabular Dialog
part 3 of 4

Putting it together

Here I have created one last marco that ties it all together. In this, I create another dialog and add the previous dialogs to it by use of the DLG_subDlg control.




global
{
  int g_Setup_Tab_Width  "!setup_tab_width";
  int g_Setup_Tab_Height "!setup_tab_height";
}

//define the size of the dialog box.
#define _TAB_SIZE   19
#define _TAB_WIDTH  80

#define h_Customize           "My Tabular Dialog"

void myTabularDialog() trans2
{
  int tw = window_id, tr = refresh;
  int tundo = undo_stat;

  //dialog handle
  int dlg;

  //defining the width of the tabular dialog box
  g_setup_tab_width = _TAB_WIDTH;
  if(g_setup_tab_width <= (_STAB_WIDTH + 4))
     g_setup_tab_width = _STAB_WIDTH + 4;

  //defining the height of the tabular dialog
  g_setup_tab_height = _TAB_SIZE;
  if(g_setup_tab_height < _STAB_HEIGHT)
     g_setup_tab_height = _STAB_HEIGHT;

  undo_stat = false;
  refresh = false;

  DlgCreate(dlg);

/*******************************************************************
    This is where it all comes together.  Once the individual dialog
   boxes have been created they can be added to a single dialog.  Each
   dialog is added by use of the DLG_SubDlg control and by calling
   the dialog macro
   *******************************************************************/
  DlgAddCtrl( dlg, DLG_TabBar,
             '',
             0,
             DLG_PosOffset,
             g_setup_tab_width,
             g_setup_tab_height,
             88,
             0  | dlgf_TabBarOwnerDraw,
             "/IL=1");

  DlgAddCtrl( dlg,
            DLG_SubDlg,
            "My Configurations",
            Dlg_PosOffset,  Dlg_PosOffset,
            0,
            0,
            -1,
            0,
            "/IM=BT_SETUP_112_s/TC=88/BM=myConfigDialog /M=1");

  DlgAddCtrl( dlg,
            DLG_SubDlg,
            "My About",
            Dlg_PosOffset,
            Dlg_PosOffset,
            0,
            0,
            -1,
            0,
            "/IM=BT_WL_100_S/TC=88/BM=myAboutDialog /M=1");

  DlgAddCtrl( dlg, DLG_PushButton,
            "OK",
            g_setup_tab_width - 34,
            Dlg_Units | ((g_setup_tab_height * 12) + 6), DLG_StanBtnWidth,
            0,
            2101,
            0,
            "/R=1");

  DlgAddCtrl( dlg,
            DLG_PushButton,
            "Cancel",
            DLG_PosOffset | (DLG_StanBtnWidth + 1), DLG_PosOffset,
            DLG_StanBtnWidth,
            0,
            2102,
            0,
            "/R=0");

  DlgExecute( dlg, 2101, "Creating tabular dialogs", h_Customize, "" , 0 );

  //removing the dialog from memory
  DlgKill(dlg);
}
Onward to part 4
'Creating a tabular dialog box'