C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-10-2002, 11:38 AM   #1
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,768
Dynamic Toolbars

Hi guys,

I'm using VC6 SP5 with MFC to create my application. I have a Framewindow and a Toolbar. I can dynamically set the toolbars buttons. BUT: Obviously Framewindow/Toolbar pairs have some kind of automation that when the parent window has no command handler ( ON_COMMAND() ) of the toolbar buttons command ID, the toolbar button is disabled. What a funny idea. I can dynamically create buttons, but not their command handlers, as I need a unique function for each... who was the genius that thought this plan up ? If you have any clue what I'm talking about and/or any helpful hints, demo sources, tutorials, please share.
Because dynamic buttons are no fun if I don't have a chance to enable them.

I surfed the .net, but nothing really dynamic came up. I need it to be really dynamic, not cheats like create a hundred and hope that's the limit. I need it to be customizable in the code, not by the user of my app.

I know I can create the button. I can set the command handler ID. But If I have no hard-coded command handler, the framework will disable the button.

Tearing my hair out already...

[Edit: If you know how to do it in API only, your welcome... I will write the Toolbar class myself if I have to, I just need those *#&% dynamic stuff... ]
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 01-11-2002, 10:21 AM   #2
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,768
Just to keep you in the loop:

I dug up countless tutorials from the net. Not one did what I needed. Probably it's mentioned nowhere how to do it. So I scanned the MFC sourcecode for a solution and after 2 hours of searching, I turned up this:

PHP Code:
class CSAZToolBar : public CToolBar
{
   
virtual void OnUpdateCmdUI(CFrameWndpTargetBOOL bDisableIfNoHandler)
   {
      
CToolBar::OnUpdateCmdUIpTargetFALSE ); 
   }
}; 
If you overwrite the function that checks if there is a commandhandler and never disable any button, it works.

I'm still quite annoyed, this is something not that uncommon... and it's not even documented, because OnUpdateCmdUI is a method of CControlBar, CToolbars baseclass... *grrrrr*

Case closed.
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic array of structures containing yet another dynamic array of structures innqubus C Programming 2 07-11-2008 07:39 AM
How do I clean up a dynamic array of pointers to objects? rakan C++ Programming 4 11-02-2006 11:41 AM
Identify dynamic IP address of network device BobS0327 Tech Board 2 02-21-2006 01:49 PM
operator overloading and dynamic memory program jlmac2001 C++ Programming 3 04-06-2003 11:51 PM
Dynamic memory confusion ripper079 C++ Programming 5 11-04-2002 06:15 PM


All times are GMT -6. The time now is 12:37 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22