GTKD2 GValue Type
Mike Wey via Digitalmars-d
digitalmars-d at puremagic.com
Wed Nov 19 13:56:35 PST 2014
On 11/19/2014 03:50 AM, Sergey wrote:
> Hello everyone!
>
> I try to use gtkd + d in production, and of course I started with
> gtk.TreeView and gtk.ListStore objects. But I encounter a problem with
> GValyue type:
>
> GValue[] array_values = cast(GValue[])["str1","str2","str3","str4"];
> file_1.d(92): Error: e2ir: cannot cast "str1" of type string to type GValue
> ...
>
> ListStore1.setValuesv(itr, [0,1,2,3], "str1","str2","str3","str4");
> file_1.d(98): Error: function gtk.ListStore.ListStore.setValuesv
> (TreeIter iter, int[] columns, GValue[] values) is not callable using
> argument types (TreeIter, int[], string, string, string, string)
>
> GValue ggg = cast(GValue)"123";
> file_1.d(78): Error: cannot cast from string to GValue
>
> GValue ggg = "123";
> file_1.d(79): Error: cannot implicitly convert expression ("123") of
> type string to GValue
>
> How to deal with this type?
>
> thanks in advance.
If it's really just strings you can use;
ListStore1.setValues(itr, [0,1,2,3], ["str1","str2","str3","str4"]);
Otherwise you'll need to make multiple calls to ListStore.setValue.
For setValuesv there is an error in the generated code it should except
an array of gobject.Value, in stead of the the C equivalent.
--
Mike Wey
More information about the Digitalmars-d
mailing list