Hi
 
Don't bother.  I've sorted it by:
 
  llExisted   = FALSE
  Close window Legend
  lnWindowID    = WindowID( 1)  
  lnNoLayers   = MapperInfo( lnWindowID, MAPPER_INFO_LAYERS) 

Just found the function's usefullness by the usual labrythine search
through Help :-)
 
Terry

________________________________

From: Terry McDonnell 
Sent: 19 July 2005 17:00
To: ([email protected])
Subject: How to focus on front window


Hi List
 
I've got open maybe several thematic layers and a legend.  I have a menu
option to disappear all these layers AND the legend.  The code is as
below:
 
Close window Legend
lnWindowID  = FrontWindow()  
lnNoLayers  = MapperInfo( lnWindowID, MAPPER_INFO_LAYERS) 
I      = 1
For I = lnNoLayers to 1 Step -1
 lcLayerName  = LayerInfo( lnWindowID, I, LAYER_INFO_NAME)
 Do CASE lcLayerName
   Case "csrZGTemp"
     Remove Map Layer "csrZGTemp"
   Case "csrNewZG"
     Remove Map Layer "csrNewZG"
   Case "csrDestZG" 
    Remove Map Layer "csrDestZG"
   Case "csrHomeZG"
     Remove Map Layer "csrHomeZG"
 End CASE
Next

Trouble is the code crashes as follows:
 
1) It seems to ignore the: "Close window Legend" cos, when I get the
error message that comes after this (see below), the legend is still
being displayed.
 
2) The legend defaults to a separate window, above my map.  Unless I
disappear it myself, or click on the map, I get the error message
"Expecting mapper window" at the line: 
 
    "lnNoLayers  = MapperInfo( lnWindowID, MAPPER_INFO_LAYERS)"
 
I take this to be because MB has taken the legend as its FrontWindow()
 
3) If first I click on the map then the above code works, and the legend
disappears.
 
So how can I force the focus onto the map, to avoid this problem (I
can't rely on the user doing this, nor should I)
 
'ppreciate it.
 
Terry McDonnell

Reply via email to