MI Undocumented (revisited)
Hello folks, I'm about to leave for two weeks vacation, but before that I'd like to donate you little bit of my knowledge on MapInfo undocumented stuff. I haven't figured them out yet, but maybe someone could explain how they work or what arethey build for(since not documented). Functions: SetHooverInfo(strDummy,strDummy) GetHooverInfo(strDummy) HooverCommand(strDummy) Clause: On Find Using statement clause Closestobj Features (or flaws): An Error$() fuction you are able to extract the error text string of a specific error number. How by generating User-defined error with Error statement and catching the the error text you are able to extrect other text resources used in MapInfo dialogs. (Jacques, this could be handy on detecting language identification and language specified dialogs!) It also serves as built-in functionality to peak in Mapinfo internals. The following code will print out all of them. Use it at your own risk though. If you decide to try it, I would be dead curious to see your prints, since Ionly got Finnish and English versions on board. Regards, Anssi '*** Include "mapbasic.def" Declare Sub Main Declare Sub Errorlist Global i, iRange As Integer Global strDump As String Sub Main CLS Dim fname As String iRange = 2^16/2 fname = PathToDirectory$(TempFileName$("")) "mapinfo.err" Open File fname For Output As #1 Charset "WindowsLatin1" i = 1 ProgressBar "Checking errorlist..." Calling Errorlist Range iRange If CommandInfo(CMD_INFO_STATUS) Then Note "Operation completed" Else Note "Operation interrupted" End If Close File #1 Run Program "Notepad.exe " fname End Sub Sub Errorlist Dim iError, iLoop, j As Integer Dim strError As String Dim start_time As Float start_time = Timer() OnError Goto PRINTERROR Do While i iRange And Timer() - start_time 1 'for some reason following three codes will freeze the machine If i Not In(2209,2212,6244) Then Error i End If BACKAGAIN: i = i+1 Loop If i iRange-1 Then ProgressBar = -1 Else ProgressBar = i End If Exit Sub PRINTERROR: strError = LTrim$(RTrim$(Error$())) iError = Err() strDump = Format$(iError,"0") " " Right$(strError,Len(strError)-InStr(1,strError,")")) iLoop = 1 Do While iLoop iLoop = InStr(iLoop+1,strDump,Chr$(10)) If iLoop Then strDump = Left$(strDump, iLoop) Chr$(9) Chr$(9) Right$(strDump, Len(strDump)-iLoop) End If Loop If Right$(strError,Len(Str$(i))+1) Str$(i) "." Then Print #1, strDump End If If i iRange Then Resume BACKAGAIN Else Exit Sub End If End Sub '***
Re: MI Undocumented
Hello again, Well, the CommandInfo connection Mark pointed out seens to be quite usefull, since including following line to SaveTableEditsHandler Procedure will not trigger "Do you want to save your changes?" dialog, but discard all changes. Set Command Info CMD_INFO_EDIT_STATUS To CMD_INFO_EDIT_DISCARD So by using it you will be able to control the closing status according to whatever. I also added couple lines to Marks code as an example. Regards, Anssi - Original Message - From: Ogilvie, Mark [EMAIL PROTECTED] To: 'Anssi Joutsiniemi' [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Sent: Friday, September 10, 1999 2:55 AM Subject: RE: MI Undocumented This is extremely interesting! In Mapbasic.def (like Anssi I'm looking at v5.0) there are the following defines under the CommandInfo section: Define CMD_INFO_EDIT_TABLE 1 Define CMD_INFO_EDIT_STATUS 2 Define CMD_INFO_EDIT_ASK 1 Define CMD_INFO_EDIT_SAVE 2 Define CMD_INFO_EDIT_DISCARD 3 The handler is triggered just *before* the table is closed. If there are unsaved edits in the table being closed the handler executes and then you get the "Do you want to save your changes?" dialog. In your SaveTableEditsHandler, if you call CommandInfo(CMD_INFO_EDIT_TABLE) you get the name of the table which is being closed. I can't work out what happens when you call CommandInfo(CMD_INFO_EDIT_STATUS). So far I have only been able to get a value of 1 back, which I guess is CMD_INFO_EDIT_ASK, meaning the table is set to prompt me if I want to save edits. I guess there must be situations in which edits are automatically saved or discarded, and Commandinfo would then return CMD_INFO_EDIT_SAVE and ~_DISCARD respectively, but I can't see what those situations would be. I have tried opening tables READONLY, and setting FASTEDIT ON, but neither of these seems to produce the expected result. I have a suspicion ~SAVE and ~DISCARD only apply to special "system" tables, such as label-layers, cosmetic-layers, grids, thematics, etc. I haven't had time to experiment further. To get a glimpse of this uncharted terrain, close a mapper window and the SaveTableEditsHandler triggers for a layer called something like "1_WINDOW". I have to do some real work. If anyone wants to experiment further, below is the MB code I used. '* include "mapbasic.def" declare sub main declare sub SaveTableEditsHandler sub main OnError goto tab_not_open_error close table test OnError goto 0 Open Table "test.TAB" browse * from test exit sub tab_not_open_error: resume next end sub 'main ' sub SaveTableEditsHandler dim i_edit_status as smallint print "In sub SaveTableEditsHandler..." print "CMD_INFO_EDIT_TABLE =" + CommandInfo(CMD_INFO_EDIT_TABLE) If Day(CurDate) Mod 2 = 0 Then Set Command Info CMD_INFO_EDIT_STATUS To CMD_INFO_EDIT_DISCARD Else Set Command Info CMD_INFO_EDIT_STATUS To CMD_INFO_EDIT_SAVE End If i_edit_status = CommandInfo(CMD_INFO_EDIT_STATUS) print "CMD_INFO_EDIT_STATUS =" + i_edit_status end sub 'SaveTableEditsHandler '*** -- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
MI Undocumented
Dear all, We all know some of them like RowID and map object functions are poorly documented for MIPro users but availablevia MapBasic documentation. Beyond that, you can find CreateView statement from StreetInfo files and so on. By poking Mires.dll file I was able come with two extra handlers, which seems to be undocumented as well (unless it is in v.5.50). SaveTableEditsHandler procedure is invoked everytime table closes and seems to be very usefull. BuildAddressHandler is something I haven't tested yet, but I assume it has something to do with geocoding feature. If you figure it out, let us all know. I wonder if anybody is keeping track on undocumented yet useful features of Mapinfo (and I don't mean peculiar key combinations that make MI crash) ? Does anybody have a clue how much of this stuff is around? Regards, Anssi
RE: MI Undocumented
This is extremely interesting! In Mapbasic.def (like Anssi I'm looking at v5.0) there are the following defines under the CommandInfo section: Define CMD_INFO_EDIT_TABLE 1 Define CMD_INFO_EDIT_STATUS 2 Define CMD_INFO_EDIT_ASK 1 Define CMD_INFO_EDIT_SAVE 2 Define CMD_INFO_EDIT_DISCARD 3 The handler is triggered just *before* the table is closed. If there are unsaved edits in the table being closed the handler executes and then you get the "Do you want to save your changes?" dialog. In your SaveTableEditsHandler, if you call CommandInfo(CMD_INFO_EDIT_TABLE) you get the name of the table which is being closed. I can't work out what happens when you call CommandInfo(CMD_INFO_EDIT_STATUS). So far I have only been able to get a value of 1 back, which I guess is CMD_INFO_EDIT_ASK, meaning the table is set to prompt me if I want to save edits. I guess there must be situations in which edits are automatically saved or discarded, and Commandinfo would then return CMD_INFO_EDIT_SAVE and ~_DISCARD respectively, but I can't see what those situations would be. I have tried opening tables READONLY, and setting FASTEDIT ON, but neither of these seems to produce the expected result. I have a suspicion ~SAVE and ~DISCARD only apply to special "system" tables, such as label-layers, cosmetic-layers, grids, thematics, etc. I haven't had time to experiment further. To get a glimpse of this uncharted terrain, close a mapper window and the SaveTableEditsHandler triggers for a layer called something like "1_WINDOW". I have to do some real work. If anyone wants to experiment further, below is the MB code I used. '* include "mapbasic.def" declare sub main declare sub SaveTableEditsHandler sub main OnError goto tab_not_open_error close table test OnError goto 0 Open Table "test.TAB" browse * from test exit sub tab_not_open_error: resume next end sub 'main ' sub SaveTableEditsHandler dim i_edit_status as smallint print "In sub SaveTableEditsHandler..." print "CMD_INFO_EDIT_TABLE =" + CommandInfo(CMD_INFO_EDIT_TABLE) i_edit_status = CommandInfo(CMD_INFO_EDIT_STATUS) print "CMD_INFO_EDIT_STATUS =" + i_edit_status end sub 'SaveTableEditsHandler '*** -- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]