![]()  | 
 
CCmdUI question | 
 
    Post Reply  
   | 
  
| Author | |
   
   znakeeye  
   
   Senior Member  
   Joined: 26 July 2006 Status: Offline Points: 1672  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: CCmdUI questionPosted: 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! 
    | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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  | 
 |
![]()  | 
 |
   
   znakeeye  
   
   Senior Member  
   Joined: 26 July 2006 Status: Offline Points: 1672  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 16 May 2007 at 12:04pm | 
 
| 
   
    
   Good idea. Thanks!
    
   
   | 
 |
![]()  | 
 |
   
   brianh  
   
   Groupie  
   Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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. 
 | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 17 May 2007 at 8:45am | 
 
| 
   
    Hi, 
Attach your mainfr.cpp. 
    | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
   
   znakeeye  
   
   Senior Member  
   Joined: 26 July 2006 Status: Offline Points: 1672  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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. 
    | 
 |
![]()  | 
 |
   
   brianh  
   
   Groupie  
   Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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!  
   ![]()  | 
 |
![]()  | 
 |
   
   znakeeye  
   
   Senior Member  
   Joined: 26 July 2006 Status: Offline Points: 1672  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 
    | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |