Jump to content
  • Advertisement
Sign in to follow this  
Coluna

Toolbar problem in MFC

This topic is 4783 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
Advertisement
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
Ughhh...i did that using class wizard...and it starts working..i didnt know i had to have a ONCLICK event to get it enabled!! thanks for the tip!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!