<[EMAIL PROTECTED]> wrote:

> The bug being, that the MB event handler named WinClosedHandler is only
> called AFTER the save/discard prompt appears.
> If it was called BEFORE the prompt (as it should be), using a
> WinClosedHandler subroutine to clear the cosmetics would do the trick.

Actually, this works exactly the way it's supposed to.  If WinClosedHandler
were triggered before the prompt, there would be no way of telling whether
the window had actually closed or not.

If you want to intercept map window closure BEFORE the prompt you need
to do something along the lines of the code following this message.
          
HTH
Spencer

----------------------------------------------------------
include "mapbasic.def"
include "menu.def" 

declare sub main 
declare sub goodbye
declare sub NewMap 
declare sub CloseThisMap 
declare sub WinFocusChangedHandler
declare sub EndHandler

sub main 
alter menu "MapperShortcut" add "Close\tCtrl+F4/W^%115/XCtrl+F4"
calling CloseThisMap 
alter menu item M_WINDOW_MAP calling NewMap 
create menu "Intercept" as "Exit" calling goodbye
end sub 

sub goodbye
create menu "Window" as default
end program
end sub

sub EndHandler
create menu "Window" as default
end sub

sub WinFocusChangedHandler
dim w as integer
w = CommandInfo (CMD_INFO_WIN)
if WindowInfo (w, WIN_INFO_TYPE) = WIN_MAPPER
    then set window w SysMenuClose Off
end if
end sub

sub CloseThisMap 
dim m as integer 
m = FrontWindow() 
close window m ' <---- no prompt! 
end sub 

sub NewMap 
dim nw as smallint 
nw = NumWindows() 
Run Menu Command M_WINDOW_MAP 
if NumWindows() > nw 
   then Set Window WindowID (NumWindows()) SysMenuClose Off 
end if 
end sub 





_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to