Michael Van Canneyt wrote 24 lines
On Fri, 7 Oct 2011, Leonardo M. Ram? wrote:
>Hi, I have a form with an ActionList, and some actions have
>single-character shortcuts. For example, when the user type the
>character "o" it execute an action.
>
>Also, in some situations, I have to place a TEdit on a TPanel over the
>main form. The problem is, when I type a word containing "o", the action
>is executed, instead of placing that character in my TEdit.
>
>How can I disable actions while typing in TEdit?.
The whole point of actions is that they are active all the time ?
What you can try to do is to use the 'OnUpdate' handler, and check if the
focus is in an edit control, and if so, disable the action. But then you'll
never be able to execute the action.
In general, I doubt that a single-character shortcut is a good idea if you
need to be able to type in edits...
Michael.
Yes, you are right. I was trying create a complicated solution to a simple problem.
My app allows to draw vectors and I'm adding the ability to add text to the drawing, in a similar way as CorelDraw or Inkscape. After the user clicks on some point, a TEdit was drawn and the user can start typing.
I solved the problem by showing a dialog with a TMemo to let the user type. This way the actions of the main form aren't involved.
Thanks.