Toolbar problem in MFC
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!!
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 :
somewhere in your code. Just add
where OnNewButtonPressed() is a function that will be called when you click on your button.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement