enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work 
Author Message
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work

I tried to enable and disable some buttons using the command ui handler by
invoking the Enable() function "but it only enables/disables the menu item"
and "not the toolbar itself".  I'm doing this inside a View (which I don't
see any reason why it shouldn't work).  Any ideas what I might be missing
here?

TIA,
John
http://www.*-*-*.com/

SDI
Win2K
VC++ 6.0



Wed, 09 Jun 2004 05:23:57 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
As you suggested, it should work. Make sure of the ID and message map entry.
If you are using SDI, then placing the ON_UPDATE_COMMAND_UI handler in view
should be OK.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> I tried to enable and disable some buttons using the command ui handler by
> invoking the Enable() function "but it only enables/disables the menu
item"
> and "not the toolbar itself".  I'm doing this inside a View (which I don't
> see any reason why it shouldn't work).  Any ideas what I might be missing
> here?

> TIA,
> John
> http://www.johncruise.com

> SDI
> Win2K
> VC++ 6.0



Wed, 09 Jun 2004 05:39:59 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
thanks Ajay for your quick response.  However, it still doesnt
enable/disable after the Enable() call.  I did try the SetCheck() and I can
see the button state change (pressed/unpressed state).

Anyway, I'll try the MainFrame (im gonna change the program flow to access
data on my mainframe instead the view from the main document though....
really ugly).

thanks again,
John


Quote:
> As you suggested, it should work. Make sure of the ID and message map
entry.
> If you are using SDI, then placing the ON_UPDATE_COMMAND_UI handler in
view
> should be OK.

> --
> Ajay Kalra [MVP - VC++]

> Note: Please post all replies to newsgroup only.



> > I tried to enable and disable some buttons using the command ui handler
by
> > invoking the Enable() function "but it only enables/disables the menu
> item"
> > and "not the toolbar itself".  I'm doing this inside a View (which I
don't
> > see any reason why it shouldn't work).  Any ideas what I might be
missing
> > here?

> > TIA,
> > John
> > http://www.johncruise.com

> > SDI
> > Win2K
> > VC++ 6.0



Wed, 09 Jun 2004 05:50:56 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
The ID might have been used multiple times and somehow the other handler is
overriding it?

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> thanks Ajay for your quick response.  However, it still doesnt
> enable/disable after the Enable() call.  I did try the SetCheck() and I
can
> see the button state change (pressed/unpressed state).

> Anyway, I'll try the MainFrame (im gonna change the program flow to access
> data on my mainframe instead the view from the main document though....
> really ugly).

> thanks again,
> John



> > As you suggested, it should work. Make sure of the ID and message map
> entry.
> > If you are using SDI, then placing the ON_UPDATE_COMMAND_UI handler in
> view
> > should be OK.

> > --
> > Ajay Kalra [MVP - VC++]

> > Note: Please post all replies to newsgroup only.



> > > I tried to enable and disable some buttons using the command ui
handler
> by
> > > invoking the Enable() function "but it only enables/disables the menu
> > item"
> > > and "not the toolbar itself".  I'm doing this inside a View (which I
> don't
> > > see any reason why it shouldn't work).  Any ideas what I might be
> missing
> > > here?

> > > TIA,
> > > John
> > > http://www.johncruise.com

> > > SDI
> > > Win2K
> > > VC++ 6.0



Wed, 09 Jun 2004 06:43:15 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
That's the first thing I checked actually.... from mainframe, document,
view... and even the main app, I'm sure its being routed to only 1 ui
command handler.

Anyway, I think I found out why... I think I need to force call the command
UI handler.  The UI handler never gets called when I changed the status of
the button so I can start from there for now  (i know... if the SetCheck()
were being called without any force updates...why not the Enable()?).  Any
message I can send to force call it?

TIA,
John


Quote:
> The ID might have been used multiple times and somehow the other handler
is
> overriding it?

> --
> Ajay Kalra [MVP - VC++]

> Note: Please post all replies to newsgroup only.



> > thanks Ajay for your quick response.  However, it still doesnt
> > enable/disable after the Enable() call.  I did try the SetCheck() and I
> can
> > see the button state change (pressed/unpressed state).

> > Anyway, I'll try the MainFrame (im gonna change the program flow to
access
> > data on my mainframe instead the view from the main document though....
> > really ugly).

> > thanks again,
> > John



> > > As you suggested, it should work. Make sure of the ID and message map
> > entry.
> > > If you are using SDI, then placing the ON_UPDATE_COMMAND_UI handler in
> > view
> > > should be OK.

> > > --
> > > Ajay Kalra [MVP - VC++]

> > > Note: Please post all replies to newsgroup only.



> > > > I tried to enable and disable some buttons using the command ui
> handler
> > by
> > > > invoking the Enable() function "but it only enables/disables the
menu
> > > item"
> > > > and "not the toolbar itself".  I'm doing this inside a View (which I
> > don't
> > > > see any reason why it shouldn't work).  Any ideas what I might be
> > missing
> > > > here?

> > > > TIA,
> > > > John
> > > > http://www.johncruise.com

> > > > SDI
> > > > Win2K
> > > > VC++ 6.0



Wed, 09 Jun 2004 07:01:53 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
You can force it by calling AfxGetApp()->OnIdle(-1). But it should be called
regardless. You can do it at the same time when you do SetCheck.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> That's the first thing I checked actually.... from mainframe, document,
> view... and even the main app, I'm sure its being routed to only 1 ui
> command handler.

> Anyway, I think I found out why... I think I need to force call the
command
> UI handler.  The UI handler never gets called when I changed the status of
> the button so I can start from there for now  (i know... if the SetCheck()
> were being called without any force updates...why not the Enable()?).  Any
> message I can send to force call it?

> TIA,
> John



> > The ID might have been used multiple times and somehow the other handler
> is
> > overriding it?

> > --
> > Ajay Kalra [MVP - VC++]

> > Note: Please post all replies to newsgroup only.



> > > thanks Ajay for your quick response.  However, it still doesnt
> > > enable/disable after the Enable() call.  I did try the SetCheck() and
I
> > can
> > > see the button state change (pressed/unpressed state).

> > > Anyway, I'll try the MainFrame (im gonna change the program flow to
> access
> > > data on my mainframe instead the view from the main document
though....
> > > really ugly).

> > > thanks again,
> > > John



> > > > As you suggested, it should work. Make sure of the ID and message
map
> > > entry.
> > > > If you are using SDI, then placing the ON_UPDATE_COMMAND_UI handler
in
> > > view
> > > > should be OK.

> > > > --
> > > > Ajay Kalra [MVP - VC++]

> > > > Note: Please post all replies to newsgroup only.



> > > > > I tried to enable and disable some buttons using the command ui
> > handler
> > > by
> > > > > invoking the Enable() function "but it only enables/disables the
> menu
> > > > item"
> > > > > and "not the toolbar itself".  I'm doing this inside a View (which
I
> > > don't
> > > > > see any reason why it shouldn't work).  Any ideas what I might be
> > > missing
> > > > > here?

> > > > > TIA,
> > > > > John
> > > > > http://www.johncruise.com

> > > > > SDI
> > > > > Win2K
> > > > > VC++ 6.0



Wed, 09 Jun 2004 07:43:27 GMT  
 enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work
Thanks... that did the trick (I'm really surprised too).

Regards,
John
http://www.johncruise.com


Quote:
> You can force it by calling AfxGetApp()->OnIdle(-1). But it should be
called
> regardless. You can do it at the same time when you do SetCheck.

> --
> Ajay Kalra [MVP - VC++]

> Note: Please post all replies to newsgroup only.



> > That's the first thing I checked actually.... from mainframe, document,
> > view... and even the main app, I'm sure its being routed to only 1 ui
> > command handler.

> > Anyway, I think I found out why... I think I need to force call the
> command
> > UI handler.  The UI handler never gets called when I changed the status
of
> > the button so I can start from there for now  (i know... if the
SetCheck()
> > were being called without any force updates...why not the Enable()?).
Any
> > message I can send to force call it?

> > TIA,
> > John



> > > The ID might have been used multiple times and somehow the other
handler
> > is
> > > overriding it?

> > > --
> > > Ajay Kalra [MVP - VC++]

> > > Note: Please post all replies to newsgroup only.



> > > > thanks Ajay for your quick response.  However, it still doesnt
> > > > enable/disable after the Enable() call.  I did try the SetCheck()
and
> I
> > > can
> > > > see the button state change (pressed/unpressed state).

> > > > Anyway, I'll try the MainFrame (im gonna change the program flow to
> > access
> > > > data on my mainframe instead the view from the main document
> though....
> > > > really ugly).

> > > > thanks again,
> > > > John



> > > > > As you suggested, it should work. Make sure of the ID and message
> map
> > > > entry.
> > > > > If you are using SDI, then placing the ON_UPDATE_COMMAND_UI
handler
> in
> > > > view
> > > > > should be OK.

> > > > > --
> > > > > Ajay Kalra [MVP - VC++]

> > > > > Note: Please post all replies to newsgroup only.



> > > > > > I tried to enable and disable some buttons using the command ui
> > > handler
> > > > by
> > > > > > invoking the Enable() function "but it only enables/disables the
> > menu
> > > > > item"
> > > > > > and "not the toolbar itself".  I'm doing this inside a View
(which
> I
> > > > don't
> > > > > > see any reason why it shouldn't work).  Any ideas what I might
be
> > > > missing
> > > > > > here?

> > > > > > TIA,
> > > > > > John
> > > > > > http://www.johncruise.com

> > > > > > SDI
> > > > > > Win2K
> > > > > > VC++ 6.0



Wed, 09 Jun 2004 07:57:16 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. How to enable/disable Toolbar button in Dialog Based MFC application

2. enable/disable toolbar button

3. Enable/ Disable Toolbar Buttons

4. enable/disable a toolbar button

5. When to enable/disable toolbar buttons?

6. How to disable/enable a button of the manfraime toolbar

7. How do I enable/disable Toolbar buttons?

8. how get the enable/disable status from toolbar button

9. Enabling - Disabling a Toolbar button

10. Enable/Disable toolbar button problem 2

11. Enabling or Disabling a toolbar button with

12. Enabling/Disabling Toolbar Buttons

 

 
Powered by phpBB® Forum Software