Solved

Tabcontrol without dialog

Posted on 2000-04-14
14
195 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

746 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

13 Experts available now in Live!

Get 1:1 Help Now