BrowserFunction unable to convert returned Object array [message #1177499] |
Sat, 09 November 2013 01:46 |
Cecile Kim 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>
|
|
|
Powered by
FUDForum. Page generated in 0.01939 seconds