CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Bangalore,karnataka,India
    Posts
    13

    Arrow accelerators to bitmap buttons

    hello
    how can i add accelerators to CBitmapButton object?

  2. #2
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: accelerators to bitmap buttons

    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.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  3. #3
    Join Date
    Mar 2004
    Location
    Bangalore,karnataka,India
    Posts
    13

    Re: accelerators to bitmap buttons

    plaese explaine with a bit of code..............

  4. #4
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: accelerators to bitmap buttons

    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 add
    Code:
    PostMessage(ADD_YOUR_ID_HERE);
    to redirect handling to the handler of your message. You can use othe redirect, from command handler to button pushing handler, but it is unconvenient.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  5. #5
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: accelerators to bitmap buttons

    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.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured