Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - ON_UPDATE_COMMAND_UI Prob using SetCheck
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ON_UPDATE_COMMAND_UI Prob using SetCheck

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


Joined: 29 October 2003
Location: Germany
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote stuebing Quote  Post ReplyReply Direct Link To This Post Topic: ON_UPDATE_COMMAND_UI Prob using SetCheck
    Posted: 30 October 2003 at 8:02am
Hi,

currently I'm trying to get a pressed button in my toolbars using the "normal" ON_UPDATE_COMMAND_UI mechanism. However, it seems as all handlers are called for checking only, i.e. with a CTextCmdUI object. For this class a SetCheck is (silently) ignored....

Using the XTP FAQ Chapter 5 does not help either, because pCmdUI->m_pOther == 0

Any help where to look at?

Ciao,
    Andreas
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: 30 October 2003 at 8:58am

Hi, Andreas

Don't understand how do you use handler. Give me please piece of code.

Back to Top
stuebing View Drop Down
Newbie
Newbie


Joined: 29 October 2003
Location: Germany
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote stuebing Quote  Post ReplyReply Direct Link To This Post Posted: 30 October 2003 at 10:03am
Hi Oleg,

ok, now I tried different things using two different buttons: an ID_EDIT_UNDO (MFC predefined ID 0xe12b) button and an ID_OWN (32771) button.

The ID_EDIT_UNDO button has its handler in my CDocument derived class and is working as expected, e.g I used pCmd->SetCheck and pCmd->Enable.

For my ID_OWN button I once tried a handler in my CDocument derived class and once in my CView derived class (only one active at a time). Inside the handler I tried once with SetCheck, once with SetPressed (a'la FAQ chapter 5).

This button is working as expected if it is contained in my first toolbar and even the second toolbar. If it was contained my third toolbar (I'm using three toolbars) it only got enabled/disabled, but no longer checked. The ID_EDIT_UNDO button was working in all three toolbars.

You noticed the change from present to past? I'm not quite sure what happened on testing for this reply, but somehow now it is working. The handler is currently in my CView derived class. Hopefully it keeps on working.

Ciao,
    Andreas
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: 03 November 2003 at 11:50pm

Please use SetCheck instead SetPressed. The last is internal method.

Recommended to use identifiers from 130 to 9000 range to avoid conflicts with MFC values and XTreme resources.

Back to Top
bmaurice View Drop Down
Newbie
Newbie


Joined: 29 November 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bmaurice Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2005 at 8:11pm
Originally posted by oleg oleg wrote:

Please use SetCheck instead SetPressed. The last is internal method.

Recommended to use identifiers from 130 to 9000 range to avoid conflicts with MFC values and XTreme resources.

We have 9600 resource how are we supposed to avoid conflicts?

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: 30 November 2005 at 1:35am

Better change it to 8600 f.e. and rebuild your application...

Now we have now resource with id = 9600, but may be it will added in future.

 

We use id range from 9000 to 10000

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


Joined: 29 November 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bmaurice Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2005 at 5:38pm

we are using resources from 101  to 9600 inclusive..

Could you add an offset base to your resources so we can shift them away from our range?

P.S.: our resource range can not be shifted due to technical specs.

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: 01 December 2005 at 5:20am

You can manually edit all Resource.h from Source directory

f.e

Source\CommandBars\Resource.h

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.125 seconds.