Re: libseed-list question on window.get_size and out arguments
- From: "Alan Knowles" <alan akbkhome com>
- To: "Jacob Beard" <libseed-list-bounces gnome org>
- Cc: libseed-list gnome org
- Subject: Re: libseed-list question on window.get_size and out arguments
- Date: Wed, 13 Oct 2010 20:25:06 +0800
This should get you started.
http://www.roojs.com/seed/Gtk.Window.html#.get_size
the mapping to C 'out' arguments works in a number of ways (partly due to backward compatibility issues)
a) Original
- if you put a object where the out argument goes, it will set argument.value to the return value.
eg. x = {}; w.get_size(x,y) -- x.value and y.value should be set.
b) the first 'out' argument has it's properties set based on the names of the arguments
eg. x = {}; w.get_size(x) - x.width, x.height should be set.
c) if the method has no return argument an object is returned with the properties based on the names of the arguments.
eg. x = w.get_size() - x.width and x.height should be set.
Code below works.
----------------
Gtk = imports.gi.Gtk;
Gtk.init(null,null );
w = new Gtk.Window();
w.signal.show.connect(function(wx) {
print("SHOW");
print(w.get_size().width);
print(w.get_size().height);
});
w.show();
Gtk.main();
Regards
Alan
--- On 13/Oct/2010, Jacob Beard wrote:
> Hi,
>
> 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, but
> haven't found any demonstrations of out arguments.
>
> I have also asked this question on stackoverflow:
> http://stackoverflow.com/questions/3916909/how-are-out-parameters-represented-for-seed-javascript-gobject-bindings/3916961#3916961
>
> I'd appreciate any insight anyone can offer into how this call should
> work under the Seed bindings. Thanks,
>
> Jake
> _______________________________________________
> libseed-list mailing list
> libseed-list gnome org
> http://mail.gnome.org/mailman/listinfo/libseed-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]