# PetscDrawGetMouseButton
Returns location of mouse and which button was pressed. Waits for button to be pressed. 
## Synopsis
```
#include "petscdraw.h" 
PetscErrorCode PetscDrawGetMouseButton(PetscDraw draw, PetscDrawButton *button, PetscReal *x_user, PetscReal *y_user, PetscReal *x_phys, PetscReal *y_phys)
```
Collective on draw


## Input Parameter

- ***draw -*** the window to be used



## Output Parameters

- ***button -*** one of `PETSC_BUTTON_LEFT`, `PETSC_BUTTON_CENTER`, `PETSC_BUTTON_RIGHT`, `PETSC_BUTTON_WHEEL_UP`, `PETSC_BUTTON_WHEEL_DOWN`
- ***x_user -*** horizontal user coordinate of location (user may pass in NULL).
- ***y_user -*** vertical user coordinate of location (user may pass in NULL).
- ***x_phys -*** horizontal window coordinate (user may pass in NULL).
- ***y_phys -*** vertical window coordinate (user may pass in NULL).



## Note
Only processor 0 actually waits for the button to be pressed.




## See Also
 `PetscDraw`, `PetscDrawButton`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/interface/dmouse.c.html#PetscDrawGetMouseButton">src/sys/classes/draw/interface/dmouse.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/impls/image/drawimage.c.html#PetscDrawGetMouseButton_Image">PetscDrawGetMouseButton_Image in src/sys/classes/draw/impls/image/drawimage.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/impls/win32/win32draw.c.html#PetscDrawGetMouseButton_Win32">PetscDrawGetMouseButton_Win32 in src/sys/classes/draw/impls/win32/win32draw.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/impls/x/xops.c.html#PetscDrawGetMouseButton_X">PetscDrawGetMouseButton_X in src/sys/classes/draw/impls/x/xops.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/draw/interface/dmouse.c)


[Index of all Draw routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
