Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Problem with repaint tab in TabControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with repaint tab in TabControl

 Post Reply Post Reply
Author
Message
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post Topic: Problem with repaint tab in TabControl
    Posted: 22 April 2005 at 7:52am
Hello, I have probably basic problem but I don't know how to resolve it. I use CXTPTabControl and in OnInitDialog() function insert 2 tabs into it and settings tab parameters. Each tab contains different dialog in different class as it's content. Problem is that when I switch in result program between particular tabs, it doesn't work correctly their repainting. In new tab stay content of previous tab, but when I drag over this window some other application, it's their content repaint and content is correctly already. I try to look to similar examples as TabManager or Toolbox but I can't find out which control is necessary to use to invoke repainting content of dialog when the select tab is changed (if it's necessary to do in class which contains cxtptabcontrol and classes of dialogs or in each dialog class). Can you help me, please ? Thanks

Example of inicialization of CXTPTabControl content:
BOOL CTest::OnInitDialog()  
{
        CXTPTabPaintManager* mgr = m_TabCtrl.GetPaintManager();
       //style settings
        mgr->SetAppearance(xtpTabAppearancePropertyPage2003);
        mgr->m_bBoldSelected = true;
        mgr->m_bOneNoteColors = true;

        m_TabCtrl.ModifyStyle(0,     WS_VISIBLE|WS_ CHILD|SS_NOTIFY|WS_CLIPCHILDREN|WS_CLIPSIBLINGS);
        //image list settings
        CImageList m_ilTabCtrl;
        m_ilTabCtrl.Create(16,16, ILC_COLOR32|ILC_MASK, 0, 2);
        m_ilTabCtrl.Add(AfxGetApp()->LoadIcon(IDI_AVSTATISTICS));
        m_ilTabCtrl.Add(AfxGetApp()->LoadIcon(IDI_AVASOPTIONS));
        m_TabCtrl.SetImageList(&m_ilTabCtrl);
      
        //inserting particular class to tab control
        CString res_str = _T("");       
        int nTab = m_TabCtrl.GetItemCount();
        res_str.LoadString(IDS_NAME_STATISTICS);

        m_pASStatistics.Create(CStatistics::IDD, &m_TabCtrl);
        m_TabCtrl.InsertItem(nTab, res_str, m_pASStatistics, 0);
        nTab++;

        res_str = _T("");       
        res_str.LoadString(IDS_NAME_OPTIONS);

        m_pASSOptions.Create(COptions::IDD, &m_TabCtrl);
        m_TabCtrl.InsertItem(nTab, res_str, m_pASSOptions, 1);

        m_TabCtrl.ShowIcons(TRUE);

        return TRUE;
}
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2005 at 11:19pm
Tab Control send TCN_SELCHANGE notification. You can try to redraw your dialogs after them become selected.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 3:50am
Thanks for your reply, but it doesn't work. I look that TCN_SELCHANGE is used in CXTTabCtrlBaseEx and it isn't possible to use in CXTPTabControl. Even if I try to used it as it's in example in manual, it doesn't work, this function wasn't use (I verify it by breakpoint and by tab item changing).
I use:
//{{AFX_MSG_MAP(CTest)
ON_MESSAGE(TCN_XT_SELCHANGE, OnTabSelChange)
//}}AFX_MSG_MAP

LRESULT CTest::OnTabSelChange(WPARAM wParam, LPARAM lParam)
{
    CXTPTabControl* pTabCtrl = (CXTPTabControl*)lParam;
    ASSERT_VALID(pTabCtrl);

    int nID = (int)wParam;
    if (nID == IDC_ONACCESSTAB)
    {        
         &nbs p;  Invalidate(FALSE);
    }
    return 0;
}
In other hand I find out that class CXTPTabManager from which is derived CXTPTabControl contains method virtual void OnItemClick( CXTPTabManagerItem* pItem ). I hope that it's the right method but I'm not sure how to used them by correctly way. It isn't neither message in manual to assign this method to message map and neither example in samples. I tried to use it this way, but it didn't work, method wasn't call by tab item changing:
void CTest::OnItemClick(CXTPTabManagerItem* pItem)
{
    Invalidate(FALSE);
}
Please can you help me?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 1:30pm

You Must Use ON_NOTIFY insterad of ON_MESSAGE

 

also you can override SetSelectedItem:

void CTest::SetSelectedItem(CXTPTabManagerItem* pItem)

{

    CXTPTabControl::SetSelectedItem(pItem);

   ::Invalidate(m_hwndClient);
}

Also you can attach sample project with problem I will correct it and attach fix.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post Posted: 27 April 2005 at 6:59am
Thanks for your response but I find out problem and resolved it myself (in cooperation with my colleague). Problem was that I have in both dialogs GroupBox. If we set a Transparent property to these groupboxes, problem was resolved and dialogs are repainted correctly. 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.