|
Hello,
I quit using VB about 2 years ago, v5 and MI v4.5,
and use Delphi [pascal] exclusively
The power is far beyond VB [especially WinAPI], not
to mention 20 times faster, and
no baggage to distribute -- just the
EXE.
This is from my Delphi code but will give you the
idea,
Quotes around strings are ' [single] in Delphi so sending commands is easier than VB where you have to do the """" something """" [multi-quote] trick HELPER CONVERSION NOTES:
Lines don't end until ; semi-colon is
encountered
Equal is := colon and equal
Multiple commands for IF-THEN FOR-NEXT DO-LOOP etc
are always contained inside begin/end
Hope this helps...............
==========================
USING THE MapInfo SEARCH POINT IN
AUTOMATION
1) Create a tool button [invisible in ole anyway] Place this right after starting MI and passing it any global DIM statements MIStr:='Create ButtonPad "Searcher" As ToolButton '+ 'Calling OLE "SrchPnt" '+ 'ID 1900'+ 'Icon '+MI_ICON_ARROW+ 'Cursor '+MI_CURSOR_FINGER_UP+ 'DrawMode '+DM_CUSTOM_POINT; MIMap.DO(MIStr); 2) Create in VB a procedure called "SrchPnt" [I think this is a CLASS defination] This needs to take a "wide string" procedure SrchPnt(Const sPnt: WideString);safecall; 3) The procedure is as follows
// get the Lat/Lon where user clicked and number of objects found // ClickX:=MIMap.Eval('format$(CommandInfo('+CMD_INFO_X+'),"####.############")'); ClickY:=MIMap.Eval('format$(CommandInfo('+CMD_INFO_Y+'),"####.############")'); nFound:=MIMap.Eval('SearchPoint('+MapID+','+ClickX+','+ClickY+')'); // if nothing found for the MapID and Lat/Lon then show message // otherwise get the information about where the user clicked if nFound='0' then begin showmessage('No Objects Found At '+ClickX+' '+ClickY); end else begin // get table name from MI // sTable:=MIMap.Eval('SearchInfo(1,'+SEARCH_INFO_TABLE+')'); // must be from the Street Layer// if sTable='BaseFile' then begin // get the RowID from MI // SrchRec:=MIMap.Eval('SearchInfo(1,'+SEARCH_INFO_ROW+')'); // have MI select the record to SEL and paste it to WinClipBoard // MIStr:='Select * from '+sTable+' where RowID='+SrchRec+' into Sel '+ 'Fetch First From Sel '+ 'Run Menu Command '+M_EDIT_COPY; MIMap.DO(MIStr); // clear the text edit // Form1.GetClipBoard.Clear; // paste text from clipboard to text edit // Form1.GetClipBoard.PasteFromClipboard; // get the text from the text edit // Trash:=Form1.GetClipBoard.Text; Junk:=''; // clear the clipboard // Form1.GetClipBoard.Clear; // update the info text boxes by parsing out the tab [#9] delimited text // for x := 0 to (Form1.sbDataBase.ComponentCount-1) do begin if x mod 2 = 1 then begin // when no more tabs [#9] just get data [last field] // if pos(#9,Trash)>0 then begin Junk:=copy(Trash,1,Pos(#9,Trash)-1); Trash:=copy(Trash,pos(#9,Trash)+1,length(Trash)); end else begin Junk:=Trash; end; // put text in appropriate edit box // tsEdit(Form1.sbDataBase.Components[x]).text:=Junk; end; end; end; end; Trey Pattillo Operations & GIS Coastal Bend 911 Network 2910 Leopard St Corpus Christi, TX 78408 ph: 1.361.881.9911 pg: 1.361.270.3908 [enter ph#] fx: 1.361.883.5749 em: [EMAIL PROTECTED] |
- Sending MI event Info to VB Aine Deery
- Trey Pattillo
