All mouse coordinates become relative to window. To release the mouse, use releaseMouse.
Example:
-- grab the mouse for TheWindow captureMouse( TheWindow )
See Also: changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
This behaves like setMousePointer(), but does not stack the previous shape for later restore.
It just changes the top of the stack shape.
However, using a special style value (0, -1 or -2) will cause no change to take place.
Use this routine, rather than setMousePointer(), when you continuously monitor the mouse position and update cursor accordingly, as it avoids a lag effect when the mouse lingers in some area of a window and then leaves to an area that displays another shape.
Example:
-- Change mouse pointer in MyWindow and all its child controls to hourglass setMousePointer( {MyWindow}, WaitPointer ) -- Do some long job, and allow pinpointing some place -- changeMousePointer(MyWindow,Cross) -- Restore the shape that was changed for WaitPointer. restoreMousePointer( {MyWindow} )changeMousePointer( ListPanel, "SpecialCursor.cur") -- this one does all children of WindowX recursively changeMousePointer( {WindowX}, "hourglass")
See Also: captureMouse, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
See Also: captureMouse, changeMousePointer, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
The hotspotX and hotspotY values are the "hotspot". The image is a 2x2 text sequence of the pointer. Bytes are interpreted as follows:
' '
= transparent
'.'
= solid white
'x'
= solid black
Example:
constant PlusPointer = createMousePointer( 8, 8, { " xxxxxx ", " x....xx ", " x....xx ", " x....xx ", " x....xx ", "xxxxxx....xxxxxx ", "x..............xx", "x..............xx", "x..............xx", "x..............xx", "xxxxxx....xxxxxxx", " xxxxx....xxxxxxx", " x....xx ", " x....xx ", " x....xx ", " xxxxxxx ", " xxxxxx "} )-- set as pointer for MyWindow setMousePointer( MyWindow, PlusPointer )
See Also: captureMouse, changeMousePointer, clickPointerLeft, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
pos is a two-element sequence that contains the X and Y location to drag the pointer to.
Example
dragPointerTo( {100, 200} )
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
This returns a two-element sequence that specifies the X and Y position of the mouse pointer.
Example:
sequence pospos = getPointerPos() if pos[1] > 200 then -- code goes here... end if
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
Example:
sequence pospos = getPointerRelPos(myWindow) if pos[1] > 200 then -- code goes here... end if
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
Example:
atom cnt cnt = getWheelScrollLines()
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
If this returns zero, then the cursor was not loaded.
mC = loadCursor("hands.ani") setMousePointer(myList, mC)
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
This is called after captureMouse to put control of the mouse back to normal.
Example:
-- release the mouse. releaseMouse()
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, restoreMousePointer, setDragPointer, setMousePointer, setPointerPos
This restores the pointer shape for id by popping it from the id's stack.
id can either be a single control ID, or a sequence containing a control ID.
You use the second form to restore the pointer for all the controls contained
in id.
Example:
-- Change mouse pointer in MyWindow to hourglass setMousePointer( {MyWindow}, WaitPointer ) -- Do some long job... . . . -- Restore the previous shape. restoreMousePointer( {MyWindow} )
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, setDragPointer, setMousePointer, setPointerPos
Win32lib supports four cursor shapes for dragging.
style can be either an atom (handle) or a sequence of four handles. If it is an
atom then set all four drag pointers to the same value.
The sequence represents these shapes:
Initially all shapes are set to the CrossPointer.
Handles can be either one of the predefined system shapes, one created by createMousePointer() or one returned by loadCursor().
Example:
setDragPointer( IconPointer )setDragPointer( {IconPointer, -- set the 'normal' shape 0 -- leave exsting 'Shift' shape alone loadCursor(mycursor), -- load 'Ctrl' shape from a file. } )
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setMousePointer, setPointerPos
This saves the current pointer for id by pushing it onto the id's stack and sets the pointer as the new shape. You can get the previous pointer shape by calling restoreMousePointer().
id can either be a single control ID, or a sequence that contains a control ID. You use the second form to set the pointer for all the controls contained in id.
The initial mouse pointer displayed is the ArrowPointer, except for TextEdit and MleText controls, which use the IBeamPointer.
The pointer can either be a special value, a system pointer, or one created with the createMousePointer function, or a path to .CUR or .ANI file. Special values are:
Repeated use of setMousePointer() with the same shape will result in it being stored only once. This way, a single call to restoreMousePointer() willl restore the previous shape, if any.
If the mouse pointer is not above id, the cursor shape change is effective only when the cursor comes above id.
Known system mouse pointers are listed here Example:
-- Change mouse pointer in MyWindow and all its child controls to hourglass setMousePointer( {MyWindow}, WaitPointer ) -- Do some long job... . . . -- Restore the previous shape. restoreMousePointer( {MyWindow} )-- use a shape stored in some external file setMousePointer( ListPanel, "SpecialCursor.cur") -- this one does all children of WindowX recursively setMousePointer( {WindowX}, "hourglass")
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setPointerPos
pos is a two-element sequence that specifies the X and Y position that the mouse pointer is to be moved to.
Example:
-- Move the mouse pointer to 120,76 setPointerPos({120, 76})
See Also: captureMouse, changeMousePointer, clickPointerLeft, createMousePointer, dragPointerTo, getPointerPos, getPointerRelPos, getWheelScrollLines, loadCursor, releaseMouse, restoreMousePointer, setDragPointer, setMousePointer