Re: How to point and click mouse?
- Posted by DerekParnell (admin) Dec 26, 2012
- 1414 views
SnakeCharmer said...
I need program for clicking to some points periodically.
We need a lot more detail before we can answer this.
Which platform? MS-DOS, Windows, Linux? Which GUI system will use use? wx, qt, win32lib, ... ? What Euphoria? Ver 3 or ver 4?
If you are using Windows and Win32lib, the common method is to handle either the Mouse or Click event.
-- example procedure onMouse(integer self, integer event, sequence parms) if parms[1] = LeftDown then savePos = {parms[2], parms[3]} -- get the X/Y position of the mouse. end if end procedure setHandler (TheWindow, w32HMouse, routine_id("onMouse"))
From the Win32lib manual ...
parms = { integer event, integer x, integer y, integer shift, integer wheelmove } The event parameter will be one of the following values: MouseMove: the mouse was moved LeftDown: the left mouse button was pressed RightDown: the right mouse button was pressed LeftUp: the left mouse button was released RightUp: the right mouse button was released LeftDoubleClick: the left mouse button was double clicked RightDoubleClick: the right mouse button was double clicked WheelMove: The mouse wheel has moved. The x and y parameters specify where the mouse is located. If the mouse has been grabbed (see captureMouse), the values of x and y can be negative if the mouse is outside the client area. The shift parameter has bits set indicating the if the keyboard shift, control, and alt keys are pressed, and which mouse button was pressed. The masks are: ShiftMask --> Left and/or Right Shift key down ControlMask --> Left and/or Right Control key down AltMask --> Left and/or Right Alt key down WinMask --> Left and/or Right Windows key down KeyMask --> Any of the Shift/Control/Alt keys down. LeftBtnMask --> Left mouse button down. RightBtnMask --> Right mouse button down. MiddleBtnMask --> Middle mouse down. BtnMask --> Any mouse button down. -- Is one of the shift keys is held down? if and_bits( shift, ShiftMask ) then . . . end if -- Check for the combination Ctrl and Right Mouse. if and_bits( shift, ControlMask+RightBtnMask ) then . . . end if The WheelMove parameter describes the direction and size of the mouse wheel movement. A value greater than 0 means that the wheel moved 'up' or away from the user, and a value less than zero means the wheel moved 'down' or towards the user. And of course, a value of 0 means that it didn't move at all. The speed, or size, of the movement is the absolute value of this parameter. You can use this in conjunction with getWheelScrollLines() to work out how the mouse wheel movement should effect your application.