Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Yet another bug: Ribbon, SetCurSel
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Yet another bug: Ribbon, SetCurSel

 Post Reply Post Reply
Author
Message
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Topic: Yet another bug: Ribbon, SetCurSel
    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
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post 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
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: 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
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post 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
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: 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
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.594 seconds.