Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > onMouseUp

onMouseUp

Declaration
Parameters
Remarks
Revisions
Example

Declaration

void __stdcall onMouseUp(
    int button,     // mouse button that was released
    int x,          // x-coordinate of agent under mouse
    int y,          // y-coordinate of agent under mouse
    int modifiers); // modifier keys pressed
Top of page

Parameters

button
Mouse button that was released. Either ssBtnLeft or ssBtnRight.
x
X-coordinate of agent (zero based) under mouse cursor.
y
Y-coordinate of agent (zero based) under mouse cursor.
modifiers
Keys that are being pressed (eg. Ctrl, Alt, Shift, or mouse button). Some combination of the following values (defined in api2model.h):
ssKbdShift
Shift key
ssKbdAlt
Alt key
ssKbdCtrl
Ctrl key
ssBtnLeft
left (primary) mouse button
ssBtnRight
right (alternate) mouse button
Top of page

Remarks

This optional function may be provided by the model. It is called every time the user releases a mouse button over the view portal. Use the modifiers to detect if modifier keys are being pressed simultaneously. For example, if the Ctrl key is being pressed then the bitwise operation (modifiers & ssKbdCtrl) will evaluate to true.
Top of page

Revisions

API v1.6
  • new!
Top of page

Example

//--------------------------------------------------------------------------- void __stdcall onMouseUp(int button, int x, int y, int modifiers) { int nbrCount; pState *nbr; pState a = xyAgent(x,y,nbr,nbrCount); if (button==ssBtnLeft) { if (modifiers & ssKbdShift) a[0] += 10; else a[0]++; } if (button==ssBtnRight) { if (modifiers & ssKbdShift) a[0] -= 10; else a[0]--; } } //---------------------------------------------------------------------------
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:43pm