Print Page | Close Window

Problem with repaint tab in TabControl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2147
Printed Date: 09 May 2024 at 11:49pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem with repaint tab in TabControl
Posted By: lajbr
Subject: Problem with repaint tab in TabControl
Date 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;
}



Replies:
Posted By: Oleg
Date 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


Posted By: lajbr
Date 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?


Posted By: Oleg
Date 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


Posted By: lajbr
Date 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. 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net