Author/View Mode Resizing issue.

When I'm in author mode (Editing my spaces site) the gadget doesn't resize properly. When I switch to view mode then back to edit mode it works fine.. It also always works fine in view mode.

I'm starting to think it's a glitch in the framework, it's driving me nuts.

I didn't publish it live.. I registered it using the testing API's published on the spacecraft.

// register your Gadget's namespace

registerNamespace("abc.Live.Gadget");

// define the constructor for your Gadget (this must match the name in the manifest XML)

abc.Live.Gadget.xyz =function(p_elSource, p_args, p_namespace)

{

// always call initializeBase before anything else!

abc.Live.Gadget.xyz.initializeBase(this, arguments);

var m_module = p_args.module;

// Private method to output

this.Output =function()

{

if (p_args.module.getMode() == Web.Gadget.Mode.view ) {

var url ="Some Url"

}else

{

var url ="Some Other Url"

}

// I put the same url in both locations and the issue still happens..

p_elSource.innerHTML ="<iframe id=\"aaa\" src=\"" + url +"\" frameborder=\"0\" style=\"width: 97%; height: 600px; border: 0px;\" scrolling=\"auto\"></iframe>";

m_module.resize(); // Tried with lower case "r" and upper "R" on resize .. I seen examples of both. SDK says lowercase.

m_module.Resize();

}

abc.Live.Gadget.xyz.registerBaseMethod(this,"Output");

this.initialize =function(p_objScope)

{

// Call base class's initialize method

abc.Live.Gadget.xyz.getBaseMethod(this,"initialize","Web.Bindings.Base").call(this, p_objScope);

this.Output();

}

abc.Live.Gadget.xyz.registerBaseMethod(this,"initialize");

this.dispose =function(p_blnUnload)

{

// Usually, you would add your dipose code here, but we have nothing to dispose for this Gadget

p_elSource =null;

// always call the base object's dispose last!

abc.Live.Gadget.xyz.getBaseMethod(this,"dispose","Web.Bindings.Base").call(this, p_blnUnload);

}

abc.Live.Gadget.xyz.registerBaseMethod(this,"dispose");

}

abc.Live.Gadget.xyz.registerClass("abc.Live.Gadget.xyz","Web.Bindings.Base");

[4825 byte] By [Rodcet] at [2008-1-10]
# 1

Couple things:

  • Module.resize() doesn't resize anything. It just tells the framework to try to resize the gadget iframe. The framework should do this on its own anyway, and if it can't figure out how to resize on its own then Module.resize() isn't going to fix it either.
  • 600px for your inner iframe is HUGE! 400px vertical is really the largest you should go with any gadget, and that's really too big as well.

Can you explain what actually happens when it fails to resize? Is the inner iframe sized properly and you have to scroll (you might try with Firefox so you'll have scrollbars on the gadget frame)?

Personally, my suggestion would be not to use an inner iframe and actually write a real gadget, but that's your decision :)

ToddOs at 2007-9-3 > top of Msdn Tech,Gadgets,Web Gadget Development...
# 2

Be aware that gadgets on Spaces do no follow the same rules on sizing that gadge on live.com do. There is a maximum of about 250px height for a spaces gadgets.

Gadgets only take up 1/2 of the width of the larger columns on spaces. Gadgets on live.com always take up the entire width of whatever column they are placed on. If you are developing a gadget for spaces, make sure to test it on spaces, not just on live.com

ShawnClark-MSFT at 2007-9-3 > top of Msdn Tech,Gadgets,Web Gadget Development...