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

new gtk.MenuItem Overloaded Constructor Problem

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



Joined: 07 Aug 2007
Posts: 40

PostPosted: Sun Nov 29, 2009 10:29 am    Post subject: new gtk.MenuItem Overloaded Constructor Problem Reply with quote

Must be a bad week. I'm having a lot of stupid small problems.

When I try to initialise a new instance of gtk.MenuItem, I get a compile error using the following constructor:

this(void delegate(MenuItem) dlg, string label, string action, bool mnemonic = true, AccelGroup accelGroup = null, char accelKey = '\x00', GdkModifierType modifierType = (GdkModifierType).CONTROL_MASK, GtkAccelFlags accelFlags = (GtkAccelFlags).VISIBLE);

Here is the snippet:

Code:
new MenuItem(&onMenuActivate, "_About", "help.about");


and here is the command line output:

Code:
C:\zane\programming\D\server_gui>dsss build
main.d => main
main.d(43): Error: constructor gtk.MenuItem.MenuItem.this (GtkMenuItem*) does not match parameter types (void function(MenuItem menuItem),char[6u],char[10u])
main.d(43): Error: expected 0 arguments, not 3 for non-variadic function type MenuItem()
Command C:\dmd\dsss\bin\rebuild.exe returned with code 1, aborting.
Error: Command failed, aborting.


I am using Win XP SP2, DMD v1.051, DSSS v0.78, GtkD v1.2

If I use this constructor, I do not encounter any compile errors:

this(string label, bool mnemonic = true);

Thanks for any help that can be provided!
_________________
わたしがプログラマだよ!
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Mon Nov 30, 2009 3:00 pm    Post subject: Reply with quote

Is onMenuActivate a member function. eg. part of a class or a nested function. Global functions create a function pointer not a delegate.
Back to top
View user's profile Send private message
zane.sims



Joined: 07 Aug 2007
Posts: 40

PostPosted: Sat Dec 12, 2009 3:49 pm    Post subject: Reply with quote

Right again sir! I did some reading on delegates & function pointers and now have a greater understanding. Thanks again!
_________________
わたしがプログラマだよ!
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