Sign in to follow this  

Toolbar problem in MFC

This topic is 4421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello; Im having a stupid bug here: when i add a new button to the toolbar, it gets DISABLED (grayed and no clik allowed), even if i set TBBUTTONINFO.fsState with enabled or anything else...strange is that the toolbar has about 10 buttons, and only with the new ones the problem is ocurring...but if i set the ID of a new button with an old ID, it works....does anybody knows what can be happening? thanks!!

Share this post


Link to post
Share on other sites
You have to map an event handling function for that button. If there isn't any action associated with a given button, then it's disabled.
You should have something like :


BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_WM_CLOSE()
// ....
END_MESSAGE_MAP()



somewhere in your code. Just add


ON_COMMAND(NEW_BUTTON_ID, OnNewButtonPressed)


where OnNewButtonPressed() is a function that will be called when you click on your button.

Share this post


Link to post
Share on other sites

This topic is 4421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this