August 06, 2020, 02:50:39 pm

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Puzzled - any ideas?

Started by Andy, July 26, 2020, 04:26:00 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Well I have got all the undo / redo functions working in my rich edit control editor, and it's time to add in those shortcut keyboard functions.

But I am puzzled on this one - does anyone have any ideas / theories...

1. The rich edit control is sub classed.
2. I have mouse right click options for cut / copy / paste.
3. They work correctly.
4. The keyboard shortcut uses the same code as the mouse functions.
5. The "Paste" is doubling up on the code.

Example:

1. I cut a line with ENDIF
2. I paste with the mouse.
3. The new line shows ENDIF.

Now using the keyboard:
1. I cut a line with ENDIF (Ctrl + X)
2. I press Ctrl + C.
3. The new line is ENDIFENDIF

Finally I worked out that I need to disable the built in Ctrl + V, because when I change the paste ADDACCELERATOR to Ctrl + T it's okay.

So does anyone know how to disable / remove the built in Ctrl + V for a rich edit control - or better still change what it does in the sub classed handler?

I am not using the IWB @RTCUT command, I copy and delete the highlighted text myself and then delete it.

Help anyone please?

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

in your subclass procedure msg handler trap the pressing of the Ctrl-C key
something like this
   SELECT uMsg
      CASE WM_KEYDOWN
         SELECT wParam
            CASE VK_C
               IF GetKeyState(VK_CONTROL) THEN   RETURN 0
         ENDSELECT
   ENDSELECT













LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

It's always a relief when you are stuck and someone lends a hand - thanks!

I was on the right lines and it was only when I realised the problem - a CTRL + X or a CTRL + C sends the selected text to the clip board.

So with this in mind I simply cleared the clip board and used my own large ISTRING (ClipText2 which also holds the selected text) instead - and it works!

Code Select
CASE WM_KEYUP
     IF wParam = 17 'Ctrl Key
        CtrlDown = 0
     ENDIF


Code Select
CASE WM_KEYDOWN
     IF wParam = 17 'Ctrl Key
        CtrlDown = 1
     ENDIF

     IF CtrlDown = 1 and wParam = 67 or wParam = 88 'Ctrl + C / X - Copy / Cut
        OpenClipboard(w1.hwnd)
        EmptyClipboard()
        CloseClipboard()
        ClipText2 = CutLine
        CtrlDown = 0
        return 0
     ENDIF

w1 is my main window
CtrlDown is a global INT variable
CutLine is another large ISTRING which I use a lot and gets cleared afterwards.

Thanks!
Andy.
 :)

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.