Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to add Control In Tab

How to add Control In Tab

Scheduled Pinned Locked Moved C / C++ / MFC
comtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GauranG Shah
    wrote on last edited by
    #1

    Hello Friends, I am using win32 Application. In which I need to create the Tab Control. I have created the Tabs using following code, But don't know how to add Control in particular TAB. Can anybody tell me how to do this. Following is the code I am using to create the TAB.

    HWND WINAPI DoCreateTabControl(HWND hwndParent)
    {
    RECT rcClient;
    HWND hwndTab;
    TCITEM tie1, tie2;
    GetClientRect(hwndParent, &rcClient);
    InitCommonControls();
    hwndTab = GetDlgItem(hwndParent,IDC_TAB1);

    // Add tabs for each day of the week. 
    tie1.mask = TCIF\_TEXT | TCIF\_IMAGE; 
    tie1.iImage = -1; 
    tie1.pszText = L"TAB 1"; 
    tie2.mask = TCIF\_TEXT | TCIF\_IMAGE; 
    tie2.iImage = -1; 
    tie2.pszText = L"TAB2 "; 
    

    TabCtrl_InsertItem(hwndTab, 0,&tie1);
    TabCtrl_InsertItem(hwndTab, 1,&tie2);

    return hwndTab;
    }

    Thnx in advance..

    [ Screen Capture ][ Tool Tip ]

    N 1 Reply Last reply
    0
    • G GauranG Shah

      Hello Friends, I am using win32 Application. In which I need to create the Tab Control. I have created the Tabs using following code, But don't know how to add Control in particular TAB. Can anybody tell me how to do this. Following is the code I am using to create the TAB.

      HWND WINAPI DoCreateTabControl(HWND hwndParent)
      {
      RECT rcClient;
      HWND hwndTab;
      TCITEM tie1, tie2;
      GetClientRect(hwndParent, &rcClient);
      InitCommonControls();
      hwndTab = GetDlgItem(hwndParent,IDC_TAB1);

      // Add tabs for each day of the week. 
      tie1.mask = TCIF\_TEXT | TCIF\_IMAGE; 
      tie1.iImage = -1; 
      tie1.pszText = L"TAB 1"; 
      tie2.mask = TCIF\_TEXT | TCIF\_IMAGE; 
      tie2.iImage = -1; 
      tie2.pszText = L"TAB2 "; 
      

      TabCtrl_InsertItem(hwndTab, 0,&tie1);
      TabCtrl_InsertItem(hwndTab, 1,&tie2);

      return hwndTab;
      }

      Thnx in advance..

      [ Screen Capture ][ Tool Tip ]

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      GauranG33 wrote:

      don't know how to add Control in particular TAB.

      You cant add so. Actually we should process hide and show of each controls according to the current tab. For example, if there is a button in the first tab and an edit control in the second, then when the first tab is active, we have to hide the edit control and show the button. Similarly we have to hide the button and show the edit when the second tab is active. More for flexibility, we are using property sheets. In that controls for each tab are placed in different dialogs. Means one dialog for each tab. And when a particular tab is active then all the dialogs except that for this particular tab will be made hidden. So only the controls in the current tab(dialog) will be visible.

      - NS -

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups