Re: using right click as left click( mouse command)


Posted by webmaster Guido on April 01, 2001

In Reply to: using right click as left click( mouse command) posted by Mark on March 26, 2001 at 22:34:49:

: Could anybody please possibly tell me how to get a mouse to right click as it would left click in Delphi(3)

: I have to have this functionality in a final visual prograaming assignment and am at a loss.

: I know right click will show a popup menu, but never heard of it acting in the same manner as a left click...
-------------

In your event handler for mouse clicks (for example, in the OnClick handler of the form), you start by determining if it was a right click. Next, you write code for what should happen if a right click was detected.

In a Delphi application, neither a left click nor a right click does anything *by itself*. A right click does NOT show a popup menu, if you didn't write code that tells the program to do so.

Just as in any other Windows application, and of course in Windows itself, a mouse-click is an "event". Other examples of events: a keypress, the closing of a Window, a timer tick, and so on... As a programmer, you tell your program to respond to certain events, by writing "event handlers" (that's why Windows programs are called "event driven" programs).