Mastodon
Programmierung

Edit-Field placed on DrawGrid never Trigger OnChange-Event

> If a TEdit is droped inside a TDrawGrid the edit control’s OnChange event is
> never triggered even if the text was changed. Anyone know why?

Yes. Because the grid was not designed to play host to other controls it will
not reflect WM_COMMAND messages (or WM_NOTIFY) back to the hosted control as
CN_COMMAND or CN_NOTIFY. These are the messages that fire events based on
notification messages a windows control sends to its parent.

The fix is to add a handler for WM_COMMAND like

[code lang=”delphi”]procedure TControlDrawgrid.WMCommand(var msg: TWMCommand);
begin
If EditorMode and ( msg.Ctl = InplaceEditor.Handle ) Then

inherited
Else
If msg.Ctl <> 0 Then
msg.result :=
SendMessage( msg.ctl, CN_COMMAND,
TMessage(msg).wparam,
TMessage(msg).lparam );
end;
[/code]

Peter Below (TeamB)

[tags]Delphi, Components[/tags]

0 Kommentare zu “Edit-Field placed on DrawGrid never Trigger OnChange-Event

Schreibe einen Kommentar

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