Form - detectar botao direito no caption |
Top Previous Next |
how do I detect a right click and/or kill the menu for my title bar? --------------------------------------------------------------------
This is a relatively simple problem, you just need to know the correct windows message to trap. Here's how to do it:
declaration: ============ procedure WMNCRButtonDown(var Msg : TWMNCRButtonDown); message WM_NCRBUTTONDOWN;
definition: =========== procedure TMainFrm.WMNCRButtonDown(var Msg : TWMNCRButtonDown); begin if (Msg.HitTest = htCaption) then begin (your code here & the next line kills the menu) Msg.HitTest := 0; end else inherited; end;
Additional Info: ================ NC stands for non-client WMNCLButtonDown or WMNCMButtonDown may be used instead for left or middle button respectively No WM_NCRBUTTONUP message is generated, only a WM_RBUTTONUP when the mouse is release |