Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Accelerators in VC++

Accelerators in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VCsamir
    wrote on last edited by
    #1

    hi all, Actaully my Question seems to be silly but i just wanted to know can i set the same key accelerators to two ID's i.e if i have popup menu lock and unlock a object than if my accelerator is Ctrl+L then on first press of Ctrl+L it should lock object and agian on second time keypress it should unlock it... for lock and unlock the id's are different Thanks Samir

    M C K 3 Replies Last reply
    0
    • V VCsamir

      hi all, Actaully my Question seems to be silly but i just wanted to know can i set the same key accelerators to two ID's i.e if i have popup menu lock and unlock a object than if my accelerator is Ctrl+L then on first press of Ctrl+L it should lock object and agian on second time keypress it should unlock it... for lock and unlock the id's are different Thanks Samir

      M Offline
      M Offline
      Moak
      wrote on last edited by
      #2

      Hi Samir! Assign Ctrl+L to ID_APP_OBJECT_TOGGLE, and write a command handler that toggles the object (lock/unlock object depending on current state). Does that work for you? Hope it helps. /M

      Webchat in Europe :java: (only 4K)

      1 Reply Last reply
      0
      • V VCsamir

        hi all, Actaully my Question seems to be silly but i just wanted to know can i set the same key accelerators to two ID's i.e if i have popup menu lock and unlock a object than if my accelerator is Ctrl+L then on first press of Ctrl+L it should lock object and agian on second time keypress it should unlock it... for lock and unlock the id's are different Thanks Samir

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        You could have 2 accelerator tables, one for lock and one for unlock assigned to Ctrl+L and swap between them when needed, or if you create the accelerator table programatically using CreateAcceleratorTable[^] then you could re-create the table with the new key-command assignments as needed, but i doubt you want to go thorough this trouble to implement an ugly solution. You are probably better off assigning a third command to Ctrl+L whose handler will toggle/negate the current state as someone already suggested.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <

        1 Reply Last reply
        0
        • V VCsamir

          hi all, Actaully my Question seems to be silly but i just wanted to know can i set the same key accelerators to two ID's i.e if i have popup menu lock and unlock a object than if my accelerator is Ctrl+L then on first press of Ctrl+L it should lock object and agian on second time keypress it should unlock it... for lock and unlock the id's are different Thanks Samir

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          write a function ChangeLock() of your object :-O

          Press F1 for help or google it. Greetings from Germany

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups