A common use of Sidewinder is to host web applications that were designed to run in a web browser. Often these applications create new browser windows in order to provide part of their functionality, but in many situations it would be useful to have control over the creation of these windows and control their position, whether they dock or autohide, and so on.
Sidewinder allows us to do this via the renderer-request-newwindow event, which is dispatched whenever the hosted web application requests a new window. A scripted application can register for this event and when triggered, create a renderer object which will be returned to the web application. This renderer can have all of the usual features, such as autohide, opacity and so on.
To register for the event, we need an EventListener with a handleEvent function:
function handleEvent(event)
{
...
}
var listener = new EventListener;
listener.SetHandler(handleEvent);
koolim = new Renderer(
{
Type : "xhtml",
Title : "Sidewinder: Kool IM",
Style : 0x00000040|0x00000800|0x00001000|0x00400000|0x20000000,
Edge : "right",
Position : "middle",
AutoHide : true,
Width : 256
}
);
koolim.Create();
koolim.addEventListener("renderer-request-newwindow", listener, true);
Now, whenever any web application hosted by this renderer requests a new window (using window.open) our event handler will be invoked. To provide a renderer to be used by the web application, we implement the handleEvent method.
First we create some global variables, so that the JavaScript engine doesn't remove our windows when the function returns:
var message; var listener; var koolim; var listener; var param;
The handleEvent method itself first creates a renderer:
function handleEvent(event)
{
message = new Renderer(
{
Type : "xhtml",
Title : "Sidewinder: Message",
Style : 0x00000040|0x00000800|0x00001000|0x00400000|0x20000000,
Edge : "left",
Position : "top",
AutoHide : true,
Width : 298,
Height : 298
}
);
message.Create();
message.Show();
before returning it to Sidewinder via the Event object.
event.parameter.objectValue = message.GetRenderingImplementation(); }
The parameters to the renderer can be set as required. For example, the position of the window could be set, based on how many previous windows had been opened.


Recent comments
7 weeks 3 days ago
9 weeks 2 days ago
16 weeks 2 days ago
40 weeks 4 hours ago
49 weeks 4 days ago
1 year 48 weeks ago
1 year 48 weeks ago
2 years 1 day ago
2 years 1 week ago
2 years 1 week ago