[Lazarus] Disabling TAction while typing
Leonardo M. Ramé
l.rame at griensu.com
Fri Oct 7 20:39:09 CEST 2011
On 2011-10-07 20:34:08 +0200, Michael Van Canneyt wrote:
>
>
> 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.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list