Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

More about Tab Controls

Posted on 2000-03-23
3
Medium Priority
?
396 Views
Last Modified: 2013-11-20
I have a Tab Control. All the pages of the Tab Control display the same buttons and fields. My idea was:
OK, it's easy: I don't have to hide anything. I just make a TRANSPARENT tabcontrol. Then I add all my controls, which will be always visible, since they don't have to change.
So, the controls don't have to change, but the content will be changing according to the selected tab. That's easy, I only have to use an if-sentence and the .GetCurSel() method.
Something like:
          if (m_CTab.GetCurSel()=3)
             {m_NameInput="three"}

(All that within the OnSelchangeTab method).
OK, it works fine. Now comes the problem:
One of the fields is a text-input field, with the following code:

void CFhgDlg::OnChangeNameInput()
{
        UpdateData(TRUE);
        TC_ITEM tcItem;
        int tab = m_CTab.GetCurSel();
        if (tab >= 0)
        {
            PSTR text=(PSTR)(LPCTSTR)m_Name;
            TC_ITEM tcItem;
            ::ZeroMemory((PVOID)&tcItem, sizeof(tcItem));
            tcItem.mask = TCIF_TEXT;
            tcItem.pszText=text;
            m_CTab.SetItem(tab,&tcItem);
            UpdateData(TRUE);
         }

This code comes from a last week question: it just changes the name of the tab, displaying what the user is typing in the text-input field.
That works, the name of the tab is changed, but all the controls in the
tabcontrol dissapear (with the m_CTab.SetItem(tab,&tcItem) command). The tab-control is no longer transparent!! What can I do??
And something more:
How does the property "transparent" of the tab-control work?(in the ressource editor: right click on a tab-control -> Properties -> Extended Styles -> Transparent). I mean, when I mark this property, the tabcontrol isn't transparent at all. I have to left it unmarked if I want to use it as transparent.
0
Comment
Question by:javigil1
  • 2
3 Comments
 
LVL 5

Expert Comment

by:vachooho
ID: 2650327
when you add child controls - which window is the parent of those childs?
tab?
Try to refresh tab:
Invalidate();
UpdateWindow();

or refresh each child window
0
 

Author Comment

by:javigil1
ID: 2650378
Right! The question was sooo easy, but I'm really new  in the MFC world.
The second part of the question is still unsolved: If I want the tabcontrol to be transparent, I have to leave the property "transparent" unmarked. So, when I work with the ressource editor it isn't transparent, but when I run the programm it is.
0
 
LVL 5

Accepted Solution

by:
vachooho earned 400 total points
ID: 2650426
Here is the excerpt from MSDN

WS_EX_TRANSPARENT   Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.

I am not sure what is happening in your case - I need more information about child controls - their parents, styles and extended styles to be sure in answer.

Anyway, you can always adjust you tab styles using
m_Tab.ModifyStyleEx(WS_EX_TRANSPARENT, 0);

try this before updateing your tab ctrl.
0

Featured Post

Industry Leaders: 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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 …
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.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 17 hours left to enroll

810 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