IonicWind Software

IWBasic => General Questions => Topic started by: Andy on July 26, 2020, 04:26:00 AM

Title: Puzzled - any ideas?
Post by: Andy on July 26, 2020, 04:26:00 AM
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.
Title: Re: Puzzled - any ideas?
Post by: LarryMc on July 26, 2020, 10:34:37 AM
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













Title: Re: Puzzled - any ideas?
Post by: Andy on July 27, 2020, 02:57:24 AM
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!

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


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.
 :)