Good Day all MapInfo-L!
I'm developing an application where I have a series of custom tool
buttons that place specialized symbols in a map window. I've created a
custom symbol set (that are bit map images in .bmp format) that is
located in the custom symbol directory. I can access the symbols
through the symbol choosing tool by selecting the custom symbols and
then scrolling through the bit maps.
I would like to access them through a map basic application I am
writing. I would like to use them in two different ways: As the icon
on the tool button and as the symbol that gets placed on a map.
So far the code I have written does not seem to be able to find the
custom symbol directory or the bit map file. The code snippet is
below.
Also, is there an easy way to find out the icon id number for the
symbols that are in the "wingdings", "mapinfo cartographic" or "mapinfo
realestate" true type fonts?
If anyone can shed some light on what I'm doing wrong, I would be
grateful.
Denise Bleakly
Sandia National Laboratories
Albuquerque, NM 87185-1147
[EMAIL PROTECTED]
505-284-2535
*******************************
' File: symtest.mb
' Purpose: MapBasic tool button demo
' Tools draw symbols in an open map window for ARG Assets
' Author: drb 4/12/99
include "c:\program files\mapinfo\mapbasic\mapbasic.def"
Include "c:\program files\mapinfo\mapbasic\menu.def"
Include "c:\program files\mapinfo\mapbasic\icons.def"
'include "c:\program files\mapinfo\professional\custsymb\icons.def"
define SYM_SHAPE_STAR 35
define SYM_SHAPE_TRIGON 36
define sym_test 41
define SYM_FIRETRUCK 78 'in mapinfo Transportation TrueType Charset
define SYM_WRDDS 26
define SYM_ARMMS 2
define SYM_PIVS 3
declare Sub main
declare Sub hdlrQuit
declare Sub hdlrTool1
declare Sub hdlrTool2
declare Sub hdlrTool3
declare Function FindCosmeticLayer() as logical
declare Sub drawSymbol(byVal i as smallInt)
'dim SYM_WRDDS as symbol
dim intWinId as integer
dim strCosmeticLayer as string
sub main
' create tool bar with two custom tool buttons
Create ButtonPad "Symbol Tools" As
'Here is the standard Select Button
ToolButton
Icon MI_ICON_LETTERS_W '***** I WOULD LIKE MY CUSTOM
SYMBOL TO BE THE ICON BUTTON HERE*****
HelpMsg "Places WRDSS asset\nWRDSS"
Cursor MI_CURSOR_CROSSHAIR
DrawMode DM_CUSTOM_POINT
Calling hdlrTool1
ToolButton
Icon MI_ICON_LETTERS_A
HelpMsg "Places ARMMS asset\nARMMS"
Cursor MI_CURSOR_CROSSHAIR
DrawMode DM_CUSTOM_POINT
Calling hdlrTool2
ToolButton
Icon MI_ICON_LETTERS_P
HelpMsg "Places PIVs asset\nPIVS"
Cursor MI_CURSOR_CROSSHAIR
DrawMode DM_CUSTOM_POINT
Calling hdlrTool3
Title "Asset Symbols"
Width 6
Position (1.5,1.0) Units "in"' create menu with item to end us
End Sub
Sub hdlrQuit
End Program
End sub
sub hdlrTool1
call drawSymbol(1)
end sub
sub hdlrTool2
call drawSymbol(2)
end sub
sub hdlrTool3
call drawSymbol(3)
end sub
'***** Insert specified symbol object into cosmetic layer of map
sub drawSymbol(byVal i as smallInt)
dim ok as Logical
dim x as float
dim y as float
dim objPoint as object
ok=FindCosmeticLayer()
if not ok then
note "Please open a map window"
exit function
end if
'*** get click coords
x=CommandInfo(CMD_INFO_X)
y=CommandInfo(CMD_INFO_Y)
'*** create symbol of selected style at click location
do case i
'SYM_WRDSS = (MakeCustomSymbol("WRDSS.BMP",Blue,18,0)
'case 1 set style symbol makeCustomSymbol("WRDSS.",Black,20,0)
'*tried this, it didn't work
case 1 set style symbol makeFontSymbol("WRDSS.bmp",
black,24,"Customsym",0,0) '*** this didn't work
case 2 set style symbol makeSymbol(SYM_SHAPE_TRIGON,BLUE,12)
case 3 set style symbol makeFontSymbol(SYM_FIRETRUCK, red,24,"MapInfo
Transportation",0,0)
end case
create point into variable objPoint (x,y)
'*** place symbol on map
insert into strCosmeticLayer(Obj) Values(objPoint)
end sub
Function FindCosmeticLayer() as logical
' get name of cosmetic layer table
dim i as smallInt
FindCosmeticLayer=false
intWinId=FrontWindow()
if intWinId=0 then exit function end if
i=WindowInfo(intWinId,WIN_INFO_TYPE)
if i<> WIN_MAPPER then exit function end if
strCosmeticLayer=WindowInfo(intWinId,WIN_INFO_TABLE)
FindCosmeticLayer=true
end function
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]