Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CCmdUI question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CCmdUI question

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: CCmdUI question
    Posted: 15 May 2007 at 3:58am
Hi,
 
I have certain menu/toolbar commands that I wish to hide (on both menus and toolbars) when they are disabled. What would be the best method for this?
 
I know I can call SetVisible() explicitly, but it would be much better if this could be handled in the update handlers.
 
Any suggestions? Thanks!
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: 16 May 2007 at 5:57am
Hi,
Update handler called only for controls - not for toolbars. you can catch idle message and call SetVisible in this handler.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2007 at 12:04pm
Good idea. Thanks!
Back to Top
brianh View Drop Down
Groupie
Groupie


Joined: 30 April 2004
Location: United Kingdom
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote brianh Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2007 at 7:30am
Hi Oleg,
 
I'm not sure I understand you, surely update handlers are called for toolbar buttons?  Or do you mean they aren't called for controls in the toolbar?
 
This fits with a similar problem that I have.  I have a combobox in a toolbar and I want to disable it using an update handler (as I do for the normal buttons on the bar), but it doesn't seem to get called. :(
 
I also have some comboboxes in a drop down menu (from a toolbar button), but the handler IS called for them!  Why the difference, or am I doing something wrong?
 
Thanks.
 
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: 17 May 2007 at 8:45am
Hi,
 
Attach your mainfr.cpp.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2007 at 8:49am
I believe you have called this somewhere in your code:
pControl->SetFlags(xtpFlagManualUpdate);
 
In that case, uncomment it and it will work as expected.
Back to Top
brianh View Drop Down
Groupie
Groupie


Joined: 30 April 2004
Location: United Kingdom
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote brianh Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2007 at 9:11am
DOH! 
 
You're quite right, I had set that flag (that's what happens when you copy and paste!) and removing it fixed the problem!
 
Well 'spotted', and thanks!
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2007 at 10:43am

I had the same problem yesterday. Not too hard to pinpoint your problem =)

Glad I could help. Cya around
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.219 seconds.