GTKD2 GValue Type

via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 19 04:33:17 PST 2014


On Wednesday, 19 November 2014 at 02:50:40 UTC, 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.

D doesn't allow construction from a different type with the `Type 
name = value;` syntax. Try this:

     GValue ggg = GValue("123");
     // or shorter:
     auto ggg = GValue("123");

Haven't tested this, though.


More information about the Digitalmars-d mailing list