Tabbed Dialog Box Class

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

Environment: Windows NT4.0. SP5

Introduction

This class implements a brand new kind of dialog box that can be used with dialog based aplications.

This class contains a Tab instead of the Dialog Title Bar. What is so cool about this dialog is that the dialog actually docks to side of the desktop. Then when the dialog loses focus, the main body of the dialog disappears with only the tab remaining visible!! This is great for admin type applications that you always want your user to have available, yet not in the way.

Then when you want to reactivate the dialog, instead of searching either the Task Bar or the Task Manager for your dialog, you simply move your mouse over the dialog's tab and the complete dialog reappears!

Implementing the Tab Dialog

  1. Create your dialog resource as normal and get Class Wizard to generate a dialog class and data members for you. The dialog should'nt have the "Title Bar" and "System Menu" styles enabled.
  2. Insert TabDialog.cpp file into your project.
  3. include "TabDialog.h" file in your Dialog header File.
  4. Change the base class of the dialog to CTabDialog. Make sure you change all occurrence of CDialog to CTabDialog.
  5. On your Dialog constructor, you can modify the TabDialog properties :
    • m_hTitleIcon : handle to an icon to use as the Tab Icon
    • m_sTitle : Title to display in the Tab
    • m_bCloseBox : TRUE if you want a close bbox to appear in the Tab
    • m_bAutoTabSize : TRUE if you want the Tab Dialog to automatically compute the Tab size, depending of the Icon, the title and the close box.
    • m_nBorderPos : indicate the desktop border you want your tab dialog to be attached on. follwing values are possibles :
      • TAB_BORDER_LEFT
      • TAB_BORDER_RIGHT
      • TAB_BORDER_TOP
      • TAB_BORDER_BOTTOM
    • m_nXpos or m_nYpos : indicate the position in pixels of the tab Dialog, on the border you chosed.
    • m_bTopMost : TRUE if you want the Tab Dialog to be topMost
    • m_bAutoHide : TRUE if you want the Tab Dialog to auto show/hide when the mouse move on and out of it
    • m_nTabHeight : height of the tab in pixels.
    • m_nTabWidth : width of the tab in pixels (used if m_bAutoTabSize = FALSE)
  6. At runtime you can call the following methods : void SetTopMost(BOOL bTopMost) : specify the new TopMost status of the Window void SetAutoHide(BOOL bAutoHide): specify the new AutoHide status of the Window

The Sample Project

I have included a sample Dialog based project which illustrates how the CTabDialog class can be used. It is a very simple dialog-based application which displays some basic controls.

Downloads

Download demo project - 36 Kb
Download source - 8 Kb


Comments

  • Correction for multiple monitors

    Posted by Legacy on 11/01/2002 12:00am

    Originally posted by: prc

    Be sure to change all occurances of:

    SM_CXSCREEN
    SM_CYSCREEN

    to

    SM_CXVIRTUALSCREEN
    SM_CYVIRTUALSCREEN

    (this goes for Kim's fix as well)

    Reply
  • m_nBorderPos = TAB_BORDER_RIGHT, not working rigth

    Posted by Legacy on 03/07/2002 12:00am

    Originally posted by: Kim Andersen

    Hey there!
    
    

    There is a bug in OnInitDialog(),

    if you want your app. to start at the right screen.
    The follow code has to be added.

    ----
    In OnInitDialog() - TabDialog.cpp

    ....

    // make sure X and Y positions are correct depending on the window position

    if ((m_nBorderPos == TAB_BORDER_BOTTOM) || (m_nBorderPos == TAB_BORDER_TOP))
    m_nYpos = 0;
    else if (m_nBorderPos == TAB_BORDER_RIGHT) // Add Kim
    {
    // Get the right X pos start.
    int cxScreen = GetSystemMetrics(SM_CXSCREEN);
    m_nXpos = cxScreen - m_nInitialWidth - m_nTabHeight;
    }
    else // TAB_BORDER_LEFT
    m_nXpos = 0;

    Reply
  • Will it work with parents other than the desktop?

    Posted by Legacy on 07/13/2001 12:00am

    Originally posted by: Peter Ritchie

    Will it work as a non-modal dialog with a parent other than the desktop?


    Reply
  • How to resize the dialogue ?

    Posted by Legacy on 05/31/2001 12:00am

    Originally posted by: Baptiste Pierard

    Congratulation for this great code.
    In one of this dialog, I draw a TreeView. Sometimes, instead of the scrollbar, I would like to enlarge the dialog. How can I do that ? I try to change the Wnd property to Resizable, but the region need to be updated?
    Can you help me ???

    Thanks,

    Baptiste ;-)


    Reply
  • How to Remove The your dialog

    Posted by Legacy on 04/19/2001 12:00am

    Originally posted by: Rajesh Ugemuge

    How to remove ur dialog so that only my dialog should work

    Reply
  • Now this is a very very very good one

    Posted by Legacy on 04/18/2000 12:00am

    Originally posted by: Alberto Gattegno

    Great idea!!!! It just solved me a big problem.

    Reply
  • Excellent...

    Posted by Legacy on 02/05/2000 12:00am

    Originally posted by: mojo

    I like it....i like it alot. I'm sorry I didn't think of it. *S* Well done.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date