[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Text tool shortcuts



Martin Wuerthner wrote:
I have had a look at text tool shortcuts, which currently do not work and I have found the following:

(1) A keypress like "arrow left" moves the caret AND is handled by the hotkeys system, too, so it causes a nudge operation as well. So, if you move the caret left in text and go to the Edit menu, it says "Undo nudge".

 (2) Ctrl+letter shortcuts (e.g., Ctrl-W) are not working at all.

(3) Even if Ctrl-W (swap case) was correctly recognized it would not work because an underlying function to swap case is not yet implemented.

(2) is caused by wxWidgets setting the virtual key of Ctrl-letter combinations to the control code (i.e., 1 for Ctrl-A) instead of the uppercase letter, which is what the code expects. I have fixed that in the Keypress constructor. I also have a fix for (3).

I found the problem that causes (1) but I am wondering how to best deal with it. The problem is that the application gets THREE key messages for a keypress like "arrow left":

      IsChar() IsRelease()
1st    FALSE     FALSE
2nd    TRUE      FALSE
3rd    FALSE     TRUE

The text tool responds to presses with IsChar=TRUE and IsRelease=FALSE while the hotkey system responds to presses with IsChar=FALSE and IsRelease=FALSE. So, the text tool ignores the 1st message, which the hotkey system happily processes. Then, the text tool processes the second message. Surely, something is wrong there. What is the point in having two "press" messages for each keypress? Is this deliberate?

Martin
Martin,

The key events are:
1st        Key down
2nd       Char after processing by IM
3rd       Key up

The text tool needs to handle the char event since this is the only that can correct handle unicode characters. Having said this I can't get the cursor keys to nudge the text, what had focus when you saw the text being nudged?

I suspect that if you were using the key down event you would be getting the character code you expect.

   Luke