Hi Bob,
Please see below.
Include "C:\Program Files (x86)\MapInfo\MapBasic\mapbasic.def"
Include "C:\Program Files (x86)\MapInfo\MapBasic\menu.def"
Include "C:\Program Files (x86)\MapInfo\MapBasic\icons.def"
Declare Sub Main
Declare Sub Draw_point
Declare Sub draw_line
Declare Sub ToolHandler
Global toolhandler_flag as SmallInt
Global xstart, ystart, xend, yend as Float
Define T_DRAW_ONE_POINT 4
Define T_DRAW_LINE_PT1 5
Define T_DRAW_LINE_PT2 6
Sub Main
' Create Tools menu
Create Menu "&SV_Tools" as
"&Point" helpmsg "Draw a symbol at a given location"
Calling Draw_point,
"&Line" helpmsg "Draw a line between two given points"
Calling Draw_line
Alter Menu Bar Add "&SV_Tools"
End Sub
Sub Draw_point
toolhandler_flag = T_DRAW_ONE_POINT
Run Menu Command M_TOOLS_MAPBASIC
End Sub
Sub draw_line
toolhandler_flag = T_DRAW_LINE_PT1
Run Menu Command M_TOOLS_MAPBASIC
End Sub
Sub ToolHandler
Do Case toolhandler_flag
Case T_DRAW_ONE_POINT
xstart = CommandInfo (CMD_INFO_X)
ystart = CommandInfo (CMD_INFO_Y)
Print "Point, xstart = " +xstart
Print "Point, ystart = " +ystart
Case T_DRAW_LINE_PT1
xstart = CommandInfo (CMD_INFO_X)
ystart = CommandInfo (CMD_INFO_Y)
Print "--------------------------------------------------------"
Print "Line, xstart1 = " +xstart
Print "Line, ystart1 = " +ystart
toolhandler_flag = T_DRAW_LINE_PT2
Case T_DRAW_LINE_PT2
xend = CommandInfo (CMD_INFO_X)
yend = CommandInfo (CMD_INFO_Y)
Print "Line, xstart2 = " +xstart
Print "Line, ystart2 = " +ystart
End Case
End Sub