开发者

How are "out parameters" represented for Seed JavaScript GObject bindings?

I've just started using Seed for development. One thing that Seed's web page mentions is that it "Maps C-isms (say, out arguments, or enums) to things that make sense in JavaScript." Unfortunately, I can't find any documentation or examples for how out arguments should work. So, for example, the following call in Seed:

window.get_size()

Will return the error "GInvokeError Too few "out" arguments (handling out)"

In C, the call would be expressed by passing in two out arguments:

gtk_window_get_size(GTK_WINDOW(widget), &width, &height);

I've tried various permutations on the JavaScript call without success. I've also looked at the documentation and sample code开发者_StackOverflow中文版, but haven't found anything. Short of looking at the code, I think I'm running out of options.

I'd appreciate any insight anyone can offer into this.


var o1 = {};
var o2 = {};
window.get_size(o1, o2);

var width = o1.value;
var height = o2.value;

There's an example in http://git.gnome.org/browse/seed/tree/tests/javascript/out-test.js (when lacking documentation it's sometimes useful to look at the tests.)


Try to call this function indirectly. From this some sort of a shell function you could then pass out params to the gtk_window_get_size method and then you can work with the retrieved results. For example return it to the calling js function which in this case wants to resolve the size of the window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜