Solved

Tabcontrol without dialog

Posted on 2000-04-14
14
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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