Mouse position: Difference between revisions

Content added Content deleted
Line 806: Line 806:
use com.livecode.widget -- include the required module
use com.livecode.widget -- include the required module
--- in your handler:
--- in your handler:
variable tPosition as Point -- type declaration, a rect array struct, something like [0,1024,0,768]
variable tPosition as Point -- type declaration, tPosition is a point array struct
put the mouse position into tPosition
put the mouse position into tPosition
variable tRect as Rectangle -- type declaration
variable tRect as Rectangle -- type declaration, tRect is a rect array struct, something like [0,1024,0,768]
put my bounds into tRect
put my bounds into tRect
if tPosition is within tRect then
if tPosition is within tRect then
log "mouse position is within the widget bounds"
log "mouse position is within the widget bounds"
end if
end if

</lang>
</lang>