Solved

More about Tab Controls

Posted on 2000-03-23
3
370 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 100 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

17 Experts available now in Live!

Get 1:1 Help Now