In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (tform) protected procedure mymousedown (MSG: twmmouse ); procedure wmlbuttondown (VAR message: twmlbuttondown); message success; Procedure wmmbuttondown (VAR message: twmmbuttondown); message success; Procedure wmrbuttondown (VAR message: twmrbuttondown); message success; end; vaR form1: tform1; implementation {$ R *. DFM} procedure tform1.mymousedown (MSG: twmmouse); var list: tstringlist; begin list: = tstringlist. create; If MSG. keys and mk_shift 0 then list. add ('shift '); If MSG. keys and mk_control 0 then list. add ('ctrl '); If getkeystate (vk_menu) 0 then list. add ('left'); If MSG. keys and mk_mbutton 0 then list. add ('ddle'); If MSG. keys and mk_rbutton 0 then list. add ('right'); canvas. textout (MSG. xpos, MSG. ypos, list. commatext); list. free; end; Procedure tform1.wmlbuttondown (VAR message: twmlbuttondown); begin mymousedown (Message); end; Procedure tform1.wmmbuttondown (VAR message: twmmbuttondown); begin mymousedown (Message); End; procedure tform1.wmrbuttondown (VAR message: twmrbuttondown); begin mymousedown (Message); end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 206 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13end