[GIS] Mouse unclick event in mapbasic


How can I respond to mouse unclick in mapinfo using mapbasic? Is there any event triggered when the mouse in unclicked? For example at the end of drawing a line when the mouse button is released.

Best Answer

CommandInfo() is a useful function which retains all information pertaining to recent events in MapBasic. I cannot remember, off hand, all of the items it returns, but I'd check that for a starting point


I have just looked at this, and you need to use the CommandInfo() function thus:

 1stX = CommandInfo(CMD_INFO_X)
 1stY = CommandInfo(CMD_INFO_Y)
 lastX = CommandInfo(CMD_INFO_X2)
 lastY = CommandInfo(CMD_INFO_Y2)
  • this returns the click xy and the xy where the user releases the mouse button.


This only applies if the toolbutton was defined with a draw mode that allows dragging, e.g., DM_CUSTOM_LINE.

Related Question