Solved

Tabcontrol without dialog

Posted on 2000-04-14
14
198 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 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