Print Page | Close Window

Yet another bug: Ribbon, SetCurSel

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=4730
Printed Date: 21 December 2024 at 1:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Yet another bug: Ribbon, SetCurSel
Posted By: ABuenger
Subject: Yet another bug: Ribbon, SetCurSel
Date Posted: 03 August 2006 at 4:59pm
In the RibbonSample add the following lines to CRibbonSampleView::OnUpdateRibbonTab at the end of the method:
 
...
 
pTab = pControl->FindTab(ID_TAB_CHARTFORMAT);
pTab->SetVisible(bVisible);
 
if (bVisible)
{
   pTab->GetRibbonBar()->SetCurSel(7);
}
 
 
Then start the app and click on Insert > Chart....
 
 
That makes it impossible to automatically select the first visible contextual tab like in Office 2007.
 
 
I've the same problem in my app and it worked with 10.20
 


-------------
Codejock support



Replies:
Posted By: ABuenger
Date Posted: 04 August 2006 at 8:56am
The problem is in CXTPRibbonBar::RebuildControls where now OnIdleUpdateCmdUI is beeing called.
 
Is there any reason why OnIdleUpdateCmdUI is beeing called explicitly?


-------------
Codejock support


Posted By: Oleg
Date Posted: 04 August 2006 at 8:59am
Hi,
 
This is not good idea to select tab each time in update handler - user will not be able to switch tabs. I'd change it to
 
 pTab = pControl->FindTab(ID_TAB_CHARTFORMAT);
 BOOL bOldVisible = pTab->IsVisible();
 pTab->SetVisible(bVisible);
 if (bVisible && !bOldVisible)
 {
  pTab->Select();
 }
 
it will activate it only once when it first become visible and resolve stack overflow problem


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: ABuenger
Date Posted: 04 August 2006 at 9:32am
Originally posted by oleg oleg wrote:

This is not good idea to select tab each time in update handler - user will not be able to switch tabs. I'd change it to
 
Sure, the sample was just to reproduct the problem.
I test my apps before releasing them
 
 
Originally posted by oleg oleg wrote:

 
 pTab = pControl->FindTab(ID_TAB_CHARTFORMAT);
 BOOL bOldVisible = pTab->IsVisible();
 pTab->SetVisible(bVisible);
 if (bVisible && !bOldVisible)
 {
  pTab->Select();
 }
 
it will activate it only once when it first become visible and resolve stack overflow problem
 
That workaround works, but it's not perfect. If I call SetCurSel in the update handler the update handler is beeing called again but GetCurSel still returns the old index and not the one I've set before.
 


-------------
Codejock support


Posted By: Oleg
Date Posted: 04 August 2006 at 10:15am
I agree... For 10.3.1 Update will call anyway but GetCurSel will return correct index.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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