Announcement

Collapse
No announcement yet.

setting hotkeys for cut/copy/paste

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • setting hotkeys for cut/copy/paste

    I have read the help text for MENU ADD STRING and ACCEL ATTACH, but it is not clear how to allow multiple hotkeys for the same item.
    Cut: SHIFT-DEL and CTRL-X
    Copy: CTRL-INS and CTRL-C
    Paste: SHIFT-INS and CTRL-V
    Does DDT support doing this?
    Erich Schulman (KT4VOL/KTN4CA)
    Go Big Orange

  • #2
    If this is a standard edit control those keys are already enabled.

    Don't know if that would apply to "CONTROL ADD TEXTBOX" controls but its worth a try.

    Note that these keys work only when the target control has the keyboard focus.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Actually, I might have found the answer.

      I found these equates in win32api.inc:

      Code:
      %APPCOMMAND_COPY                   = 36
      %APPCOMMAND_CUT                    = 37
      %APPCOMMAND_PASTE                  = 38
      %WM_CUT              = &H300
      %WM_COPY             = &H301
      %WM_PASTE            = &H302
      Would using those for my ID make all 6 hotkeys supported without my specifically enabling them?
      Erich Schulman (KT4VOL/KTN4CA)
      Go Big Orange

      Comment


      • #4
        Don't know about the APPCOMMAND_xxx messages, but WM_CUT, WM_COPY and WM_PASTE are sent to the edit control (not the owner window) (By the appliocation) to force the control to do that thing. (default procedure should do it).

        Show your screen code. If you use a edit/TEXTBOX control these keys should all work without you doing anything. (for edit for sure, for TEXTBOX I'm not so sure). (Not a DDT guy).
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          %WM_CUT etc are equates for messages sent to edit (and combobox) controls.
          You shouldn't use them directly as IDs (e.g. for menu items).

          Normally what you would do is assign our own equates to your menu item (or button etc). e.g. %IDM_CUT = 1001
          Then write callback code to respond to that item being clicked / selected...
          Code:
              Case %WM_COMMAND
                Select Case As Long CbCtl 
                  Case %IDM_CUT
                    Control Send CbHndl, %IDC_TEXTBOX1, %WM_CUT, 0, 0
          As MCM pointed out, these behaviours - cut, copy, paste etc are built in to Edit/TextBox controls
          and have hotkeys assigned to them automatically by the sytstem (even in DDT programs).

          If you want to implement those operations in a different kind of control (say a listbox), or add
          your own hot keys, you'll need to 'roll your own' and assign an accelerator table entry for each
          hot key combination. Two or more Accel table entries can point to the same command.
          Rgds, Dave

          Comment


          • #6
            .. hotkeys assigned to them automatically by the sytstem (even in DDT programs).
            Well, if DDT uses the default behavior for edit controls, a context menu with these standard text operations should appear when you right-click in the control, too.

            (It does with SDK-style).

            I use Ctrl+A, Ctrl+C, Shift+Insert (I forget the Crtrl+something key for paste) all the time with these controls.



            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              They all work just the same in DDT, including the right click menu without any extra code.
              The 3 main control codes are in a row on a standard English keyboard Ctl-X is Cut, Ctl-C is Copy , Ctl-V is paste. The first key in the row Ctl-Z is normally Undo, though its exact action can vary between programs and Ctl-A above them is Select All.

              Comment

              Working...
              X