Mastodon
Programmierung

TEdit doesn’t like to launch a Dialog – fix

TEdit does not like that you launch a dialog box from the OnEnter.
In D1 you loose the caret and the selection highlighting in any case
In D4 (not tested inD5) you have a goofing selection when arriving with a mouse click into the Edit :

Drop 2 Edit. In the 2nd OnEnter add :
[code lang=”delphi”] showMessage(‘hello’);
[/code]
Launch your application and click in the middle of the 2nd Edit text.
try to type something, and just move your mouse right or left …. STRANGE!

Workaround:
Create a user message ( WM_EDITMSG = WM_USER + x), install an event handler which will fire the dialog box, and inside the OnEnter of your Edit do a PostMessage(WM_EDITMSG, 0, 0). The event handler firing the dialog will be executed after the completion of the focusing process of the TEdit.

[tags]Delphi, Components[/tags]

0 Kommentare zu “TEdit doesn’t like to launch a Dialog – fix

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.