hello
how can i add accelerators to CBitmapButton object?
Printable View
hello
how can i add accelerators to CBitmapButton object?
You can add accelerators to commands, which will be sent to window that owns accelerator. And you can define a command, add it to accelerator list and in its handler send pushing message to your button.
plaese explaine with a bit of code..............
Go to accelerator editing window. Add accelerator, entering to ID field any yet undefined identifier that you wish to correspond with your message. VS defines that ID for you. Then if you use wizardry :) add a message handler to that ID to your (dialog?) window that owns accelerator. Otherwise add smth like ON_COMMAND(ADD_YOUR_ID_HERE,OnMyID) to the message map and OnMyID function to the class (change names of function and ID to smth that fits). In that handler handle the message. In the handler of button pushing addto redirect handling to the handler of your message. You can use othe redirect, from command handler to button pushing handler, but it is unconvenient.Code:PostMessage(ADD_YOUR_ID_HERE);
Just add & before a letter in a button text that will serve as an accelerator: B&utton for example.
Pressing Alt-u will invoke this accelerator and button’s handler will be called.