[mapguide-users] Show/Hide Layers and properties pane programmatically

Maciej Skorczewski maciej.skorczewski at procad.pl
Thu Mar 15 07:32:00 EDT 2007


Hi Farah

i make show/hide TaskArea (right menu), i thing that can help you.

Solution

1. edit files framesetnotaskbar.templ and add this

---
<frameset name="maparea" cols="*,%s,0,0" frameborder=0 border=0 
id='hide_show'>
---

after change....


<frameset rows="%s,*,%s" frameborder=0 border=0>
     <frame name="tbFrame" %s noresize scrolling=no>
     <frameset name="maparea" cols="*,%s,0,0" frameborder=0 border=0 
id='hide_show'>
         <frame name="mapFrame" 
src="%s?MAPDEFINITION=%s&TYPE=%s&SHOWLEGEND=%s&SHOWPROP=%s&INFOWIDTH=%s&LOCALE=%s&HLTGT=%s&HLTGTNAME=%s&SHOWSLIDER=%s%s" 
noresize scrolling=no>
         <frame name="taskFrame" %s noresize frameborder=1 border=1 
scrolling=no>
         <frame name="formFrame" noresize src="%s">
         <frame name="scriptFrame" noresize>
     </frameset>
     <frame name="sbFrame" %s noresize scrolling=no>
</frameset>



ok so now you add id to frame and you can call this frame by 
onclick="javascript:show_hide_right_layer();">


----- function body-------

function show_hide_right_layer()
{
GetParent().EndMeasure();
getIFrameDocument('ifrMap').getElementById('hide_show').cols="*,0,0,0";
}


function getIFrameDocument(aID){
  var rv = null;

  // if contentDocument exists, W3C compliant (Mozilla)
  if (top.document.getElementById(aID).contentDocument){
    rv = top.document.getElementById(aID).contentDocument;
  } else {
    // IE
    rv = top.document.frames[aID].document;
  }

  return rv;
   }

----- function body-------





in studio add new invoke script and i body put

----- function body-------
function show_hide_right_layer()
{
getIFrameDocument('ifrMap').getElementById('hide_show').cols="*,200,0,0";
}

function getIFrameDocument(aID)
{
  var rv = null;
  // if contentDocument exists, W3C compliant (Mozilla)
  if (top.document.getElementById(aID).contentDocument){
    rv = top.document.getElementById(aID).contentDocument;
  } else {
    // IE
    rv = top.document.frames[aID].document;
  }
  return rv;
   }



show_hide_right_layer();
----- function body-------




maciek




> I need to toggle the visibility of the layers+properties pane, 
> programmatically,  at the click of a button. How do I go about doing 
> this? Also, is there a way to do the same functionality for the map as 
> well? Is it possible to turn off the map programmatically?



More information about the mapguide-users mailing list