I've looked all over the place for info about this issue but found
nothing instructive. I have written a gadget that is almost ready for
release, except for an issue with _IG_AdjustIFrameHeight(). It is
being ignored; no resizing whatsoever. I've tried calling it multiple
times in the code, used settimer() on it to make sure it's called a
sufficient time after everything has loaded. I've also cut the code
down to nothing but the call to _IG_AdjustIFrameHeight and some text
(so there is a reason to resize the frame), but nothing... The frame
remains at whatever size it is initialized to. I've tested this in
FF3, Safari and IE7.

One post I found suggests that something on the Google side changed
earlier this month (Jun 2009) and is causing this, but no repsonses
have been forthcoming. Nobody else seems to be experiencing this, so
it must be something in my code.

Anyhow, hopefully I'm just missing something and someone will be kind
enough to point it out to me.

Thanks,
/magnus

THE CODE: (Call to _IG_AdjustIFrameHeight() is in red below, for HTML-
capable clients).
---------
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="__MSG_title__" author="AWI, Inc." author_email=""
description="__MSG_description__" screenshot="__MSG_screenshot__"
thumbnail="__MSG_thumbnail__">
<Locale messages="http://www.wildlandspress.com/gadget/languages/
ALL_ALL.xml"/>
<Require feature="tabs" />
<Require feature="dynamic-height" />
<Require feature="settitle"/>
</ModulePrefs>

<Content type="html">
<![CDATA[

<style>
#box {
height:250px;
width:100%;
}
#caption {
font-size:9pt;
color:gray;
}
#description {
font-size:8pt;
color:black;
}
#nav {
margin:0px auto;
width:100%;
}
#nav td {
font-size:7pt;
width:33%;
}
#ge {
width:100%;
text-align:center;
}
#id_map {
margin:0px auto;
margin-top:10px;
}
.left {
text-align:left;
}
.center {
text-align:center;
}
.right {
text-align:right;
}
.copyright {
color:#cfcfcf;
font-size:8pt;
}
</style>

<script src="http://maps.google.com/maps?file=js"; type="text/
javascript"></script>
<script type="text/javascript">

var position;
var currDate = '';
var host = 'http://www.wildlandspress.com';
var imgpath = '/dailypic/images/';
var gadgetpath = '/gadget/';

function callback(tabId) {
        //called during tab init and switch
        if(tabId == 'id_map') {
                if (GBrowserIsCompatible()) {
                        var geocoder = new GClientGeocoder();
                        geocoder.getLatLng(position, showMap);
                }
        }
} //callback

function showMap(point) {
        if (point!=null) {
                var map = new GMap2(document.getElementById("id_map"));
                map.setCenter(point, 7);
                map.addControl(new GSmallMapControl());
                map.addControl(new GMapTypeControl());
                var marker = new GMarker(point);
                map.addOverlay(marker);

                _IG_AdjustIFrameHeight();
        }
} //showMap

// Initialize tabs, designate the tab named "Photo" as the tab
selected by default.
var tabs = new _IG_Tabs(__MODULE_ID__, "Photo");
tabs.alignTabs("left", 10);

function init() {

        _IG_SetTitle("__MSG_title__");

        tabs.addTab("Photo", {contentContainer: _gel('id_photo'),
                callback: callback
                })
        tabs.addTab("Map", {contentContainer: _gel('id_map'),
                callback: callback
                })

        // Align tabs to the left and offset by 10 pixels
        tabs.alignTabs("left", 10);

        //fetch pic and data for the current day
        fetchContent('today');
} //init

function fetchContent(getDate) {

        var url = host + gadgetpath + 'dailyPic.php?cr=' + currDate + '&dt='
+ getDate;

        _IG_FetchContent(url, function(jsonResponse) {

                var arrData = eval('(' + jsonResponse + ')');
                var file_name = arrData['file_name'];
                var caption = arrData['caption'];
                var description = arrData['description'];
                var country = arrData['country'];
                var province = arrData['province'];
                var place = arrData['place'];
                var arrLocation = new Array(country, province, place);
                position = arrLocation.join(', ');
                currDate = arrData['assigned_date'];

                var heading = document.getElementById("heading");
                var pCaption = document.getElementById("caption");
                var pDescription = document.getElementById("description");
                var box = document.getElementById("box");
                var img = document.getElementById("picofday");

                heading.innerHTML = position;
                pCaption.innerHTML = caption;
                pDescription.innerHTML = description;

                img.src = host + imgpath + file_name;

                var imgH = img.clientHeight;
                var imgW = img.clientWidth;
                var boxH = box.clientHeight;
                var boxW = box.clientWidth;

                // Find which dimension is scaled the most
                var scaleH = boxH / imgH;
                var scaleW = boxW / imgW;

                // Scale the image
                if (scaleH < scaleW) {
                        img.style.height = box.clientHeight + "px";
                        img.style.width = Math.round(imgW * scaleH) + "px";
                } else {
                        img.style.width = boxW + "px";
                        img.style.height = Math.round(imgH * scaleW) + "px";
                }

                _IG_AdjustIFrameHeight();

                },
                { refreshInterval: 0 }
        );

} // fetchContent

// Call init function to initialize and display tabs.
_IG_RegisterOnloadHandler(init);

</script>

<div id="id_photo" style="text-align:center">
<h3 id="heading"></h3>

<div id="box">
<img id="picofday" src="http://www.wildlandspress.com/dailypic/images/
ed_blank.gif" />
</div>

<table id="nav">
<tr>
<td class="left">

<script>document.writeln("<img onclick=\"fetchContent('prev')\" alt=
\"Prev\" src=\"" + host + gadgetpath + "left.gif\" />");</script>

</td>
<td class="center">Copyright 2009</td>
<td class="right">
<script>document.writeln("<img onclick=\"fetchContent('next') alt=
\"Prev\" src=\"" + host + gadgetpath + "right.gif\" />");</script>
</td>
</tr>
</table>
<p id="caption"></p>
<p id="description"></p>
<div id="ge">
View in Google Earth
</div>
</div> <!-- id_photo -->

<div id="id_map" style="width:300px;height:400px;text-align:center">
</div> <!-- id_map -->

]]>
</Content>
</Module>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to