{"id":178,"date":"2007-05-12T16:40:40","date_gmt":"2007-05-12T14:40:40","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/mouse-how-to-hottrack-any-control\/"},"modified":"2007-05-12T16:40:41","modified_gmt":"2007-05-12T14:40:41","slug":"mouse-how-to-hottrack-any-control","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/mouse-how-to-hottrack-any-control\/","title":{"rendered":"Mouse: How to &#8220;HotTrack&#8221; any control"},"content":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]\/\/ We have to override the WndProc procedure<br \/>\nprocedure WndProc(var Message : TMessage); override;<\/p>\n<p>procedure TForm1.WndProc(var Message : TMessage);<br \/>\nbegin<br \/>\n\/\/ Here we see which component gets changed.<br \/>\n\/\/ This bit here tells us which component the mouse is over<br \/>\n    if Message.LParam = Longint(Label1) then<br \/>\n       ChangeColor(Label1, Message.Msg);<br \/>\n    if Message.LParam = Longint(Label2) then<br \/>\n       ChangeColor(Label2, Message.Msg);<br \/>\n    if Message.LParam = Longint(Label3) then<br \/>\n       ChangeColor(Label3, Message.Msg);<br \/>\n    if Message.LParam = Longint(CheckBox1) then<br \/>\n       ChangeColor(CheckBox1, Message.Msg);<br \/>\n inherited WndProc(Message);<br \/>\nend;<\/p>\n<p>procedure TForm1.ChangeColor(Sender : TObject; Msg : Integer);<br \/>\nBegin<br \/>\n\/\/ If a label is the one that the mouse is over then we<br \/>\n\/\/ do this<br \/>\n If Sender Is TLabel Then<br \/>\n  Begin<br \/>\n    if (Msg = CM_MOUSELEAVE) then<br \/>\n     (Sender As TLabel).Font.Color := clWindowText;<br \/>\n    if (Msg = CM_MOUSEENTER) then<br \/>\n     (Sender As TLabel).Font.Color := clBlue;<br \/>\n  End;<br \/>\n\/\/ If a CheckBox is the one that the mouse is over then we<br \/>\n\/\/ do this<br \/>\n If Sender Is TCheckBox Then<br \/>\n  Begin<br \/>\n    if (Msg = CM_MOUSELEAVE) then<br \/>\n     (Sender As TCheckBox).Font.Color := clWindowText;<br \/>\n    if (Msg = CM_MOUSEENTER) then<br \/>\n     (Sender As TCheckBox).Font.Color := clRed;<br \/>\n  End;<br \/>\nEnd;<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Misc, Mouse[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]\/\/ We have to override the WndProc procedure procedure WndProc(var Message : TMessage); override; procedure TForm1.WndProc(var Message : TMessage); begin \/\/ Here&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":[75,107,110],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-2S","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/178"}],"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=178"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}