Hi Davide,

The "IntPtr" parameter refers to a C function pointer, not a C# method
group. It's generally just used internally, for interop with Gtk+.

Generally, setting up accelerators looks something like this:

// Initialize the AccelGroup
AccelGroup accelGroup = new AccelGroup ();
AddAccelGroup (accelGroup);

...

// Create the create the menu item you want to set up the accelerator for
MenuItem menuItem = new MenuItem ();
// Hook up the event handler to the Activated event
menuItem.Activated += HandleMenuItemActivated;

...

// Add the accelerator for the menu item
newMenuItem.AddAccelerator
("activate", accelGroup,
 new AccelKey (Gdk.Key.Left,
Gdk.ModifierType.MetaMask, AccelFlags.Visible));


Hope this helps,
- Matthew

On Sun, Apr 11, 2010 at 2:57 PM, Davide Lasagna <[email protected]>wrote:

> Hi all,
> I'm new to mono although i've had some previous experience with pygtk. I
> have  a problem with an accelgroup. What i want to do is to bind Alt+left to
> a calback.
>
> Here is the code:
>
> AccelGroup accelgroup = new AccelGroup();
> this.AddAccelGroup(accelgroup);
>  accelgroup.Connect(Gdk.Key.Left, Gdk.ModifierType.MetaMask,
> AccelFlags.Visible, HandleGobackClicked );
>
> Compiling this gives:
> ./MainWindow.cs(62,36): error CS1502: The best overloaded method match for
> `Gtk.AccelGroup.Connect(uint, Gdk.ModifierType, Gtk.AccelFlags,
> System.IntPtr)' has some invalid arguments
> /usr/lib/cli/gtk-sharp-2.0/gtk-sharp.dll (Location of the symbol related to
> previous error)
> ./MainWindow.cs(62,36): error CS1503: Argument `#1' cannot convert
> `Gdk.Key' expression to type `uint'
>
>
> How can i solve it? The docs are not very complete on this, and i can't
> find tutorials or examples.
>
> Thanks for pointing me in the right direction.
>
> Davide
>
>
>
>
> _______________________________________________
> Gtk-sharp-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to