GtkD: Best way to get TreeStore out of TreeView.Model

Mike Wey mike-wey at example.com
Mon Jun 17 10:53:31 PDT 2013


On 06/17/2013 04:44 AM, Alex Horvat wrote:
> On Sunday, 16 June 2013 at 18:22:47 UTC, Mike Wey wrote:
>> On 06/13/2013 06:14 AM, Alex Horvat wrote:
>>> On Wednesday, 12 June 2013 at 21:44:55 UTC, Mike Wey wrote:
>>>> On 06/11/2013 07:55 PM, Alex Horvat wrote:
>>>>> On Tuesday, 11 June 2013 at 17:41:59 UTC, Mike Wey wrote:
>>>>>> On 06/11/2013 05:56 PM, Alex Horvat wrote:
>>>>>>> TreeStore store = cast(TreeStore)tvTreeView.getModel();
>>>>>>> In this case store == null
>>>>>>
>>>>>> I think that one should work, how are you setting/creating the
>>>>>> TreeStore?
>>>>
>>>> getModel returns an interface, so try the following:
>>>>
>>>> TreeStore store = cast(TreeStore)cast(void*)tv.getModel();
>>>
>>> Thanks
>>>
>>> Ok, just tried this and after setting store if I call
>>> writeln(store) the output is what looks like a memory dump,
>>> definitly something wrong there.
>>> And the program crashes if I try to use store.
>>
>> Could you try again with the latest git?
>>
>> https://github.com/gtkd-developers/GtkD/commit/ab664087b9d354f9cae7e11c17f0b7125dcf8bdd
>>
>
> OK, I pulled the changes and rebuilt gtkd but the error is still the same.
>
> I tried all the variations in code listed in my first post, plus the one
> you suggested with the double cast, but everything failed in the same
> ways as before.
>
> On the plus side, nothing new broke - it still works with the
> work-around way I've got.
>
> Is there any more info I can supply that would help you?

What OS are you using and which compiler?

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list