FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

casting Widget to ToolItem

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Lysander



Joined: 13 Sep 2011
Posts: 5

PostPosted: Tue Sep 13, 2011 8:18 pm    Post subject: casting Widget to ToolItem Reply with quote

Hello,
I am trying to populate my Toolbar with gtk.Actions.
the problem ...
Action.createToolItem() returns a Widget.
Toolbar.insert() takes a ToolItem parameter.

Without an explicit cast dmd 2.055 complains of implicit conversions (Widget to ToolItem.)

with cast(ToolItem)Action.createToolItem() I get a segmentation fault (casts to null)

I've worked around it using Toolbar.add() (inherited from gtk.container)

But what am I doing wrong? These functions are designed to work together, right?

So I guess the questions are, how do you cast among inherited classes?
And why do you have to?

Thanks for all your time and effort, I'm having loads of fun learning d, gtkd, and gtk.

btw gtkd rev 895
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Wed Sep 14, 2011 3:03 pm    Post subject: Reply with quote

Action.createToolItem should return a ToolItem, changed in svn 897
Back to top
View user's profile Send private message
Lysander



Joined: 13 Sep 2011
Posts: 5

PostPosted: Wed Sep 14, 2011 8:07 pm    Post subject: Reply with quote

Thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group