Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » BrowserFunction unable to convert returned Object array(The returned Object[] from BrowserFunction fails to convert to a javascript Array.)
BrowserFunction unable to convert returned Object array [message #1177499] Sat, 09 November 2013 01:46
Cecile Kim is currently offline Cecile KimFriend
Messages: 3
Registered: November 2013
Junior Member
I am able to return a single value from my BrowserFunction, such as a Double or String, but this fails when I try to return an Object[]. Stepping through the debugger, it looks like it fails in WebSite.convertToJS(Object), at

rgdispid = ihtmlWindow2.getIDsOfNames (new String[] {"Array"}); //$NON-NLS-1$
if (rgdispid == null) {
ihtmlWindow2.dispose ();
return new Variant ();
}

rgdispid is null, so an empty Variant object is returned.

The Browser runtime class is IE, and I am using Eclipse Keplar. I have simplified my code below. I see the 'got result' printed to the browser, but nothing after that.

Is this a bug, or am doing something wrong?

public class MapOptionsFunction extends BrowserFunction
{
public MapOptionsFunction(Browser browser, String name)
{
super(browser, name);
}

@Override
public Object function (Object[] arguments)
{
Object[] mapOptions = new Object[3];
mapOptions[0] = new Double(3.0);
mapOptions[1] = new Double(4.0);
mapOptions[2] = new Double(5.0);
return mapOptions;
}
}

map.html file is:
<!DOCTYPE html>
<html>
<head>
<title>Geo View</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

<script>
function initialize()
{
var result = omiGetMapOptions('zoom', 'center', 'mapTypeId');

document.write('got result');
document.write('0=' + result[0]);
document.write('1=' + result[1]);
document.write('2=' + result[2]);
</script>

</head>
<body onload="initialize()">
<div id="map-canvas"></div>
</body>
</html>
Previous Topic:How can I get a textured button in the toolbar with SWT for cocoa?
Next Topic:Text does not lose focus after switching Composite on StackLayout
Goto Forum:
  


Current Time: Fri Mar 29 15:22:41 GMT 2024

Powered by FUDForum. Page generated in 0.01939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top