Solved

Tabcontrol without dialog

Posted on 2000-04-14
14
197 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Macro to save highlighted rows as a separate file 5 43
fizzArray2 challenge 1 78
Not needed 13 109
Problem to App 4 78
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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