Solved

More about Tab Controls

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 55
Excel Use VBA to get user's Mac Address for their computer 5 109
sumNumber challenge 16 109
Problem to open Excel file 15 95
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

914 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