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. How can I enable/disable CEdit control context menu items?

How can I enable/disable CEdit control context menu items?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 13 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.
  • B Offline
    B Offline
    Byron Thomas Cullen
    wrote on last edited by
    #1

    well the subject says it all. I need to be able to enable/disable/hook the cut/copy/paste commands from the default CEdit control context menu. thanks ahead of time for pointing me in the right direction. byron

    E 1 Reply Last reply
    0
    • B Byron Thomas Cullen

      well the subject says it all. I need to be able to enable/disable/hook the cut/copy/paste commands from the default CEdit control context menu. thanks ahead of time for pointing me in the right direction. byron

      E Offline
      E Offline
      Erik Funkenbusch
      wrote on last edited by
      #2

      You'll need to subclass CEdit and handle the WM_CUT, WM_COPY, and WM_PASTE messages.

      B 1 Reply Last reply
      0
      • E Erik Funkenbusch

        You'll need to subclass CEdit and handle the WM_CUT, WM_COPY, and WM_PASTE messages.

        B Offline
        B Offline
        Byron Thomas Cullen
        wrote on last edited by
        #3

        Erik, Thanks for your response. I have CEdit subclassed already and I can trap the WM_COPY/CUT/PASTE messages there if I needed to in ::WindowProc. But I want to disable the menu items in the first place. In a nutshell what I am trying to do is have a custom 'read-only' state in the edit control. So I would like to be able to disable the Cut/Delete/Paste items of the default CEdit context menu when my control is 'read-only'. That way the user doesn't even have the option of selecting it. The only thing I can think of is to create my own pop-up menu and look for a right click or that other windows key. Which is do-able, but I'd rather just be able to enable/disable the default context menu items at will. Any ideas? Byron

        A 1 Reply Last reply
        0
        • B Byron Thomas Cullen

          Erik, Thanks for your response. I have CEdit subclassed already and I can trap the WM_COPY/CUT/PASTE messages there if I needed to in ::WindowProc. But I want to disable the menu items in the first place. In a nutshell what I am trying to do is have a custom 'read-only' state in the edit control. So I would like to be able to disable the Cut/Delete/Paste items of the default CEdit context menu when my control is 'read-only'. That way the user doesn't even have the option of selecting it. The only thing I can think of is to create my own pop-up menu and look for a right click or that other windows key. Which is do-able, but I'd rather just be able to enable/disable the default context menu items at will. Any ideas? Byron

          A Offline
          A Offline
          Andrew Truckle
          wrote on last edited by
          #4

          [windows 7 - How can i modify the context menu of a CEdit control? - Stack Overflow](https://stackoverflow.com/q/6265251/2287576)

          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