Sign in to follow this  
kingpinzs

need help with adding to a vector

Recommended Posts

void AddNewPage( HWND hwndParent, HWND hwndTab )
{
  //+-----------------------------------------+
  //| Get the client rect of the main window. |
  //+-----------------------------------------+
  RECT rcClient ; GetClientRect( hwndParent, &rcClient ) ;

  //+------------------------------------------------------------+
  //| Now get the appropriate display area for the edit control. |
  //+------------------------------------------------------------+
  RECT rcDisplay ; rcDisplay = rcClient ;
  TabCtrl_AdjustRect( hwndTab, FALSE, &rcDisplay ) ;

  //+---------------------------------+
  //| Hide all current edit controls. |
  //+---------------------------------+
  for ( int i=0; i < (int)vEditControls.size(); i++ )
    ShowWindow( vEditControls[i], SW_HIDE ) ;

  //+--------------------------------------+
  //| Determine the text of the new tab.   |
  //+--------------------------------------+
  TCHAR szTabName[30] ;
  wsprintf( szTabName, TEXT("Tab %d"), vEditControls.size() ) ;

  //+------------------------------------------------------------+
  //| Insert a new tab by filling in a TCITEM object and sending |
  //| the TCM_INSERTITEM message or using the TabCtrl_InsertItem |
  //| macro.                                                     |
  //+------------------------------------------------------------+
  TCITEM tcitem ;
  tcitem.pszText = szTabName ;
  tcitem.mask    = TCIF_TEXT ;       // The pszText member is valid.
  TabCtrl_InsertItem( hwndTab, vEditControls.size(), &tcitem ) ;

  //+--------------------------+
  //| Select the new tab page. |
  //+--------------------------+
  TabCtrl_SetCurSel( hwndTab, vEditControls.size() ) ;

  //+------------------------------------------------------------------+
  //| Create a new edit control, set its font, and add it to the list. |
  //+------------------------------------------------------------------+
  HWND hwndEditNew = CreateEditControl( hwndParent, rcDisplay.left,
                                        rcDisplay.top,
                                        rcDisplay.right - rcDisplay.left,
                                        rcDisplay.bottom - rcDisplay.top ) ;
  SetDefaultGuiFont( hwndEditNew, FALSE ) ;
  vEditControls.push_back( hwndEditNew ) ;
  
 }

how would I make 16 of these?

Share this post


Link to post
Share on other sites
the code makes tabs and ataches a edit window to each tab. the way it stands now I have to click a button to make a tab. I just want 16 tabs to start so in the above code some hoe I need to have it just creat 16 tabs instead of having it only creaet when a button is hit

Share this post


Link to post
Share on other sites
Um, you have code that adds something to a vector, and it gets called when a button is clicked, and you want to start out with 16?

Uh... why not just call the function directly yourself first, 16 times (in a loop)?

Share this post


Link to post
Share on other sites
whats funny is I tryed that but for some reason it did not achive the affect I wanted it just made a tab named 16 not 16 tabs unless I made my loop wrong

this is what I did
for (int i = 0;i <15;)
{
AddNewPage( hwnd, hwndTab ) ;
}

but it did not work

Share this post


Link to post
Share on other sites
well I found that link to. But I was not smart enogh to figure it all out. I got it to make tabs but I can add anything to the tabs. Not sure. If you could help me figure it out I would be most apertitive

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this