{"id":81,"date":"2007-05-12T13:43:55","date_gmt":"2007-05-12T11:43:55","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/edit-field-placed-on-drawgrid-never-trigger-onchange-event\/"},"modified":"2007-05-12T13:43:56","modified_gmt":"2007-05-12T11:43:56","slug":"edit-field-placed-on-drawgrid-never-trigger-onchange-event","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/edit-field-placed-on-drawgrid-never-trigger-onchange-event\/","title":{"rendered":"Edit-Field placed on DrawGrid never Trigger OnChange-Event"},"content":{"rendered":"<p><em>> If a TEdit is droped inside a TDrawGrid the edit control&#8217;s OnChange event is<br \/>\n> never triggered even if the text was changed. Anyone know why?<br \/>\n<\/em><br \/>\nYes. Because the grid was not designed to play host to other controls it will<br \/>\nnot reflect WM_COMMAND messages (or WM_NOTIFY) back to the hosted control as<br \/>\nCN_COMMAND or CN_NOTIFY. These are the messages that fire events based on<br \/>\nnotification messages a windows control sends to its parent.<\/p>\n<p>The fix is to add a handler for WM_COMMAND like<\/p>\n<p>[code lang=&#8221;delphi&#8221;]procedure TControlDrawgrid.WMCommand(var msg: TWMCommand);<br \/>\nbegin<br \/>\n  If EditorMode and ( msg.Ctl = InplaceEditor.Handle ) Then<\/p>\n<p>    inherited<br \/>\n  Else<br \/>\n    If msg.Ctl <> 0 Then<br \/>\n      msg.result :=<br \/>\n        SendMessage( msg.ctl, CN_COMMAND,<br \/>\n                     TMessage(msg).wparam,<br \/>\n                     TMessage(msg).lparam );<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>Peter Below (TeamB)  <\/p>\n<p>[tags]Delphi, Components[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>> If a TEdit is droped inside a TDrawGrid the edit control&#8217;s OnChange event is > never triggered even if the text was&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[90,75],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-1j","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/81"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}