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]

Reply via email to