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. Mobile Development
  3. Mobile
  4. Tap-And-Hold in Edit Controls

Tap-And-Hold in Edit Controls

Scheduled Pinned Locked Moved Mobile
c++helptutorial
5 Posts 2 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.
  • D Offline
    D Offline
    d8
    wrote on last edited by
    #1

    I have an Edit Box within a Dialog on a PPC application written with eVC++ (using MFC). I would like to implement a context menu for copy/cut/paste/undo within the Edit Box. I have read some articles about using SHRecognizeGesture to implement this feature. But, SHRecognizeGesture is usually used with the WM_LBUTTONDOWN message handler. I receive the OnLButtonDown message in my Dialog Class only when the cursor is outside of the Edit Box. Any help on how to proceed is much appreciated. :confused:

    J 1 Reply Last reply
    0
    • D d8

      I have an Edit Box within a Dialog on a PPC application written with eVC++ (using MFC). I would like to implement a context menu for copy/cut/paste/undo within the Edit Box. I have read some articles about using SHRecognizeGesture to implement this feature. But, SHRecognizeGesture is usually used with the WM_LBUTTONDOWN message handler. I receive the OnLButtonDown message in my Dialog Class only when the cursor is outside of the Edit Box. Any help on how to proceed is much appreciated. :confused:

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      To intercept a WM_LBUTTONDOWN in an edit box you will have to subclass it. Create a new class that inherits from CEdit, and override the OnLButtonDown message handler to handle the tap-and-hold. To ensure that it will work in the dialog, make sure you force class wizard to use your class in the CDialog generation (use the Control setting, not the Value). Regards, João Paulo

      D 2 Replies Last reply
      0
      • J Joao Paulo Figueira

        To intercept a WM_LBUTTONDOWN in an edit box you will have to subclass it. Create a new class that inherits from CEdit, and override the OnLButtonDown message handler to handle the tap-and-hold. To ensure that it will work in the dialog, make sure you force class wizard to use your class in the CDialog generation (use the Control setting, not the Value). Regards, João Paulo

        D Offline
        D Offline
        d8
        wrote on last edited by
        #3

        Hello Joao, I believe that I understand the method that you are describing and will try it out this week. Thank you for your advice. Best Regards, Dave Schneider

        1 Reply Last reply
        0
        • J Joao Paulo Figueira

          To intercept a WM_LBUTTONDOWN in an edit box you will have to subclass it. Create a new class that inherits from CEdit, and override the OnLButtonDown message handler to handle the tap-and-hold. To ensure that it will work in the dialog, make sure you force class wizard to use your class in the CDialog generation (use the Control setting, not the Value). Regards, João Paulo

          D Offline
          D Offline
          d8
          wrote on last edited by
          #4

          Hello Joao Paulo, I have another newby question. I was able to create a context menu (cut/copy/paste/undo) with your help. But now, I do not know how to get a pointer to the text which I selected in the edit control so that I can use the CEdit::Cut,Copy,... methods. Can you help me to understand this? Thanks and Best Regards, Dave Schneider

          J 1 Reply Last reply
          0
          • D d8

            Hello Joao Paulo, I have another newby question. I was able to create a context menu (cut/copy/paste/undo) with your help. But now, I do not know how to get a pointer to the text which I selected in the edit control so that I can use the CEdit::Cut,Copy,... methods. Can you help me to understand this? Thanks and Best Regards, Dave Schneider

            J Offline
            J Offline
            Joao Paulo Figueira
            wrote on last edited by
            #5

            Hi Dave, To get the selected portion of the text, you use the EM_GETSEL message or, if using MFC, CEdit::GetSel. These will return indexes to the starting and ending characters of the selected substring. To retrieve the full string, use GetWindowText. Regards, João Paulo

            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