Downloads

Comments

typo?

Bad example if you want to access Controls from different Tabs

Posted by hoschy
on 07/18/2006 05:36am

It works quite nice, BUT
I want to access lets say a editcontrol in one tab from the main dialog, its just not possible.
ItB4s better to use the main Dialog for Initialization and stuff, this way you can access all editcontrols in the main Dialog. And this is what most users want i think.

Resolution to Strange behaviour on keypress

Posted by ksumit
on 04/09/2004 04:11am

All that needs to be done is add OnCancel() event handlers for all the child dialogs/forms.And within this get the Parent dialog pointer and distroy the dialog. For key press (enter) have an event handler OnOK for each child dialogs.

Another way to get data from Tab to Main Dialog

Posted by pkpk
on 03/31/2004 07:15pm

I ran across this on Google Groups it works well:
In your tab class code use the following line to get a hook to the main dialogs member variables and functions
CMyTabExampleDlg* pMainWnd = (CMyTabExampleDlg*) AfxGetMainWnd();
pMainWnd will then give you access to main dialog

Strange behaviour on keypress (enter-/esc key)

Posted by Stoodent
on 03/26/2004 09:06am

If you put the focus to any control whithin the tab area so that the OK or CANCEL button is not selected and you hit the enter key the tab page will disappear.
I think that the reason for this is that WM_ERASEBKGND will be sent to the child window (tab page) without a WM_PAINT after the key has been pressed.
I don't think it is a good way just to ignore any WM_ERASEBKGND messages by implementing WindowProc(...), so does anybody know a better solution ?

RE: Strange behaviour on keypress (enter-/esc key)

Posted by JOC_Consulting
on 12/18/2009 06:05pm

I noticed the same problem of the Enter/Esc key causing the tab page dialog to disappear. According to the "Property Sheet as the View Window of a CFrameWnd" article at http://support.microsoft.com/kb/161886 , the reason is that the Enter and Esc keys, in MFC, are normally routed to OnOK and OnCancel, respectively. This article includes sample code that shows not only how to deal with the Enter and Esc keys, but also how to implement using Ctrl + Tab to go to the next tab page and Shift + Ctrl + Tab to go the previous tab page. My application has only 2 tabs so it hard to tell for sure, but this code seems to work properly.

Select a tab programmatically

Firstly, many thanks to Ben Hill for showing me how to use the Tab Control. Like Alexis Giotis I also want to select a tab programmatically. Eventually I worked out how to do it by adding the another member function

However, I can only get this to work when it is added after the line
m_tabMyTabCtrl.Init();
in CMyTabExampleDlg::OnInitDialog() which, although it can be used to change the initial tab, it is not what I want.

If I use, say, m_tabMyTabCtrl.SelectTab(2); in another class (associated with a Check dialog with code in a TabCheck.cpp file) then I get an error message on compilation indicating that m_tabMyTabCtrl is not a class. I think that I have included all of the appropriate .h files in the .cpp file.

This is all tied up with file scope. Please be kind to me as this is only my second C++ program! Although I am an experienced Fortran, Visual Basic programmer, C is new to me (and I am struggling).

Very cool but!

I have studied your code, and implemented it sucessfully in a dialog however...

I am writing a control panel applet, and when used, none of the controls in the 'sub' dialogs seem to get focus or have the ability to respond when clicked.

I personally belive this has somthing to do with implementing this code in a dll however, I am not sure. Any ideas?

Thanks
Karim

Change parent?

Posted by Sam Hobbs
on 03/26/2004 08:21pm

I think the parent of the dialogs for the tabs is supposed to be the same parent as the tab control; that is not logical but Windows is not always logical. In this sample, the parent is the tab control.

Problem with tab in the bottom and the "&"-sign

Very great job with the tabcontrol, but one minor problem I can't fix.
If you move the tabs to the bottom, everything is great, except when you add an "&"-sign anywhere in your text. The moment you press the specific tab, the text bumps up a bit. It looks a bit silly.

Application Die

I had create a main Dialog with a button that will show a sub dialog when click.

I create the tabControl in this sub Dialog. The funny thing is; I had no problem with one tab link to a child dialog. Problem occur when I try to add more tabs link to more child dialogs. The application die everytime I try to access the sub dialog. Worst, there is no error msg. I don't know where to trace my problem. Can somebody out there assist me?

Top White Papers and Webcasts

When individual departments procure cloud service for their own use, they usually don't consider the hazardous organization-wide implications. Read this paper to learn best practices for setting up an internal, IT-based cloud brokerage function that service the entire organization. Find out how this approach enables you to retain top-down visibility and control of network security and manage the impact of cloud traffic on your WAN.

U.S. companies are desperately trying to recruit and hire skilled software engineers and developers, but there is simply not enough quality talent to go around. Tiempo Development is a nearshore software development company. Our headquarters are in AZ, but we are a pioneer and leader in outsourcing to Mexico, based on our three software development centers there. We have a proven process and we are experts at providing our customers with powerful solutions. We transform ideas into reality.