Windows Sidebar Gadget: System Undefined

I’ve developed a couple of gadgets and have found that, since installing the latest built of IE7 or Windows 7 the settings pages have broken.

From some initial testing it seems as something has changed in the Sidebar event model.

What happens is that when handling the onload event of a gadget’s settings page, System hasn’t been loaded yet (thus the System undefined error). So there is no way to properly initialize the settings page’s  html Controls using the System.Gadget.Settings object.

I’ve also tried using the System.Gadget.onShowSettings event from my gadgets main pages to initialize my settings pages’ html controls but the problem then is that the Settings Pages haven’t been loaded yet so there is no dom access to my html controls.

Has anyone else noticed this problem?

<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title><title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link type="text/css" rel="stylesheet" href="css/luna/luna.css" /> 
<script type="text/javascript" language="javascript" src="js/Settings.js"><script> 
<head> 
<body onload="InitPage()" style="width: 500px; height: 500px; font-size:xx-small"> 

 

function InitPage() { 
    //<-- This causes System Undefined error 
    System.Gadget.Settings.Read("someSetting"); System.Gadget.onSettingsClosing = SettingsClosing; }
 
Comments

Yes, I”ve got exactly the same problem with one of my gadgets. The Flyouts when running in Windows 7/IE8 all fail with “System is undefined”.

I found a solution to the problem using msdn forums.
Just open your html pages (flyout or settings page in my case) using notepad and save them using unicode encoding, that solves the “System is undefined” problem.
At least it did in my case…

This thread”s a little old, but I just ran into this problem today. I revised my initialization code as follows:

function init() {
if (System){
// initialization code
} else {
setTimeout(“init()”, 1000); // Try again in a second
}
}

Leave a Reply