In my toolbar, I want to have a login/logout button. The button goes from logout to login state and vice versa. Both the state has a different icon. I tried changing the icon but it did not work.
Also, what does MF_DISABLED do? I can click the button in the disabled state.
I am afraid you cannot change the icons.
Are you on Windows or Mac?
Sorry for replying late was busy with something else.
I want to do it on both.
Are you seeing that you can click on a button with
MF_DISABLED on Windows?
Yes , I checked on Windows.
If that state is set properly the button should be disabled and unclickable.
You can’t change a UI toolbar button images on the fly [you can change cursor images and of course buttons in custom dialogs when using HTML etc].
To keep it simple I suggest that you use an image that indicates “Login/Logout” and your code checks the action against the user’s current status - so if they are logged in and they click it it says “Do you want to logout? Y/N” etc.
There are many premade icons available - like this one [resize it to 24px sq etc to suit button]:
An alternative is to have 2 buttons … Login and Logout.
When logged in the Login button is greyed and disabled, and the Logout button is enabled.
After logging out the states of the buttons are reversed, ie only the Login button is enabled.
I see the same. Looks like
MF_GRAYED has to be used.
The MSDN documentation doesn’t make me much wiser to why this is the case…