Solved

Tabcontrol without dialog

Posted on 2000-04-14
14
196 Views
Last Modified: 2013-11-20
HI,
    I want to use tab control in an MDI form,not in a dialog. How should one proceed for it?

Thanx,
Thiru
0
Comment
Question by:thirumaran
14 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2715750
Create it dynamically
CTabControl *tab1;
tab1.Create(...); etc...
0
 

Expert Comment

by:ch52jb
ID: 2716437
Make sure the view used is a CFormView derived class, and draw the tab on the form in the resource editor.
0
 

Author Comment

by:thirumaran
ID: 2718476
Adjusted points from 20 to 40
0
 

Author Comment

by:thirumaran
ID: 2718477
Hi inpras/ch52jb,
  Could you please explain me with an example

Thanx,
Thiru
0
 

Author Comment

by:thirumaran
ID: 2718487
Hi inpras/ch52jb,
  Could you please explain me with an example

Thanx,
Thiru
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 40 total points
ID: 2719281
> Make sure the view used is a CFormView derived class, and
 > draw the tab on the form in the resource editor.

But CFormView creates is own dialog.  Are you saying you don't want dialogs for some specific reason, thirumaran, or are you just saying you want the control to appear in an MDI Child window?

..B ekim
0
 

Author Comment

by:thirumaran
ID: 2720399
Hi mikeblas,
        I want the control to appear in MDI form. How should i write the code for it? Kindly help me with an example.

Thanx,
Thiru
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Expert Comment

by:mikeblas
ID: 2720725

I suspect that you want to have the content of the form switch around depending on which tab the user has selected. If that's what you want, your best bet is to use a CPropertySheet instead.  See the SNAPVW sample that ships with Visual C++ for a very complete example of how to get that all wired-up.

If you really want only the tab control, then just draw it. You can create a sample yourself by doing this:

1) Create a new app with the AppWizard. Ask for an MFC EXE.
2) In the last step of the AppWizard, select your view class in the list of classes, then change the base class for it to "CFormView".
3) Finish the project.
4) Open the resources in your new project.
5) Open the form view's dialog.
6) Draw a tab control on it.

Later, you'll probably want to use ClassWizard to add a CTabCtrl member variable to your view so you can more readily manipulate the control. Just do this:

1) Open ClassWizard
2) Select the "member variables" tab
3) Select your view in the "Class Name" dropdown
4) Select your control in the list box.
5) Click "Add Variable"
6) Type a name you like.
7) Make sure you've got "Category" set to "Control" and "Variable Tye" set to CTabCtrl"

That's that. Now you can use the new variable to manipulate the control (eg, check its setting, add tabs, and so on.)

..B ekiM
0
 

Author Comment

by:thirumaran
ID: 2721583
How to make the MDI form to occupy the whole screen along with the child form which is inside it. This should be the default window size.

Thanx,
Thiru
0
 

Author Comment

by:thirumaran
ID: 2721806
Hi,
   When running,how to make the MDI form to occupy the whole window?

Thanx,
thiru
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2723378
Gosh! A grade of "C"?? What more did you want?  Did I not answer the question you put forth?

 > When running,how to make the MDI form to occupy the whole window?

If you were upset that this follow-up wasn't answered, you should have asked it _before_ making your grade.

What motivates me to answer you, now that you've given me such a crummy grade?  Luckily, I'm a good sport:

You can see the technique you need to use in the SNAPVW sample I mentioned. Check out the CSnapView::OnSize() handler. It measures the contained window and forces the view to be the same size. You can do the same thing with a tab control, too.  (You haven't told me if you chose to use a tab control or a property sheet.)

Remember to set the styles on the frame window containing the view so the user knows it won't be sizeable.  The sample does this in the PreCreateWindow() overried in its CChildFrame class.  Just knock off the WS_THICKFRAME bit, and add a WS_BORDER bit.

..B ekiM

0
 

Author Comment

by:thirumaran
ID: 2725252
Hi,
   Sorry for that. It is the case of mistaken clicking of the radio button. I dont have the snapvw sample with me. I am using a tab control only at present.
May be i can put up some other dummy question where you can get a good grade.

Thanx,
Thiru
0
 

Author Comment

by:thirumaran
ID: 2725255
Hi,
   Sorry for that. It is the case of mistaken clicking of the radio button. I dont have the snapvw sample with me. I am using a tab control only at present.
May be i can put up some other dummy question where you can get a good grade.

Thanx,
Thiru
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2727299
> I dont have the snapvw sample with me.

It's on the Visual C++ product CD.  And the MSDN CD, too.  And it's on the MSDN website.

 > May be i can put up some other dummy question where you
 > can get a good grade.

That's up to you.

..B ekiM

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now