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

andrea tiveron (e-metodi) andrea.tiveron at e-metodi.it
Mon Jul 25 04:20:58 EDT 2011


I worked on a new revision of the code because the id of the button can
change dynamically.

here is the final code:

var xframe = GetMapFrame();
var aryClassElements = new Array();
var objBtn;
function findbtnbytitle(titolo) {
imgs = xframe.parent.frames[0].document.images;
for(i=0;i<imgs.length;i++){
if(imgs[i].title==titolo){
objBtn =imgs[i]
return objBtn;
}
}
}
if(xframe.document.getElementById("InfoBand").style.width ==
'0pt')
{
xframe.minInfoWidth=20;
xframe.ResizeTo(200);
xframe.InitialMapView();
objBtn = findbtnbytitle('Open the layer pane');
objBtn.src='../stdicons/openButton.gif';
objBtn.title='Close the layer pane';
}
    else
{
xframe.minInfoWidth=0;
xframe.ResizeTo(0);
xframe.document.getElementById("LayerCaption").style.width = 0;
xframe.document.getElementById("LegendCtrl").style.width = 0;
xframe.document.getElementById("PropertyCaption").style.width = 0;
xframe.document.getElementById("PropertyCtrl").style.width = 0;
xframe.InitialMapView();
objBtn = findbtnbytitle('Close the layer pane');
objBtn.src = '../stdicons/closeButton.gif';
objBtn.title='Open the layer pane';
}

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of andrea tiveron
(e-metodi)
Sent: sabato 23 luglio 2011 16:43
To: 'MapGuide Users Mail List'
Subject: RE: [mapguide-users] Show/Hide Layers and properties pane by script

I review my code:
var xframe = GetMapFrame();
if(xframe.document.getElementById("InfoBand").style.width ==
'0pt')
{
xframe.minInfoWidth=20;
xframe.ResizeTo(200);
xframe.InitialMapView();
xframe.parent.frames[0].document.getElementById("I40").src='../stdicons/open
Button.gif';
xframe.parent.frames[0].document.getElementById("I40").title='Close the
layer pane';
}
    else
{
xframe.minInfoWidth=0;
xframe.ResizeTo(0);
xframe.document.getElementById("LayerCaption").style.width = 0;
xframe.document.getElementById("LegendCtrl").style.width = 0;
xframe.document.getElementById("PropertyCaption").style.width = 0;
xframe.document.getElementById("PropertyCtrl").style.width = 0;
xframe.InitialMapView();
xframe.parent.frames[0].document.getElementById("I40").src =
'../stdicons/closeButton.gif';
xframe.parent.frames[0].document.getElementById("I40").title='Open the layer
pane';
}
you can add this command in your tool bar menu
andrea
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of andrea tiveron
- metodi srl
Sent: lunedì 12 novembre 2007 19:22
To: 'MapGuide Users Mail List'
Subject: RE: [mapguide-users] Show/Hide Layers and properties
paneprogrammatically

 
I add an Invoke Script Command with this code:

if(parent.frames[1].document.getElementById("InfoBand").style.width ==
'0px')
{
parent.frames[1].minInfoWidth=20;
parent.frames[1].ResizeTo(200);
parent.frames[1].InitialMapView();
}
    else
{
parent.frames[1].minInfoWidth=0;
parent.frames[1].ResizeTo(0);
parent.frames[1].document.getElementById("LayerCaption").style.width = 0;
parent.frames[1].document.getElementById("LegendCtrl").style.width = 0;
parent.frames[1].document.getElementById("PropertyCaption").style.width = 0;
parent.frames[1].document.getElementById("PropertyCtrl").style.width = 0;
parent.frames[1].InitialMapView();
}

not very elegant but it works

andrea
 
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Willem Schwarte
Sent: Monday, March 19, 2007 10:02 AM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] Show/Hide Layers and
propertiespaneprogrammatically

Hi Maciek,

Did you happen to solve this problem of hiding/showing the legend pane?

Willem




-----Oorspronkelijk bericht-----
Van: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] Namens Maciej Skorczewski
Verzonden: donderdag 15 maart 2007 13:54
Aan: MapGuide Users Mail List
Onderwerp: Re: [mapguide-users] Show/Hide Layers and propertiespane
programmatically


> Sorry for the trouble again!! :-)
> Do we have to define  the code for getIFrameDocument()? Or is it an 
> existing method? I keep getting an error for that method. Also, is 
> ifrMap the name of ur frame in the main page like 
> ajaxtiledviewersample.js in the javaviewersample aplication?

this i my function.


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;
  }


maciek.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

--
This message was scanned by ESVA and is believed to be clean.



More information about the mapguide-users mailing list