[Gtk-sharp-list] Menu.Popup
McP
mariano.cano@hispalinux.es
05 Oct 2003 23:22:42 +0200
This code works for me:
void MouseClick(object o, ButtonPressEventArgs args)
{
Gdk.EventButton ev = args.Event;
...
if(ev.button == 3)
{
if(popup_menu == null)
{
Glade.XML gui = new
Glade.XML(null,"monotageditor.glade","menu1",null);
popup_menu = (Gtk.Menu) gui["menu1"];
....
}
...
popup_menu.Popup(null,null,null,IntPtr.Zero,ev.button,ev.time);
return;
}
}
...
}
El vie, 03-10-2003 a las 22:12, Jason Boutwell escribió:
> I am getting an error when I try to call Menu.Popup().
>
> The docs suggest setting the first four args to null. However, the
> fourth arg is an IntPtr, which doesn't appreciate being set to null. I
> tried setting it to IntPtr.Zero, and then it compiled, but generated a
> null pointer runtime error when executed. It looked to be expecting the
> func arg to not be null.
>
> The gtk docs suggest that it is ok to set a gpointer to NULL in C,
> however C# chokes on a null IntPtr.
>
> A bug perhaps?
>
> Can anyone show me their Popup method call that gets around this.
>
> Thanks!
>
> Jason
>
>
>
> On Mon, 2003-09-29 at 18:44, John Luke wrote:
> > Todd Berman wrote:
> >
> > >Has anyone gotten Menu.Popup to work in response to a ButtonPressEvent?
> > >
> > >
> > >
> > >Currently, I can get it to 'kinda' work, it popups up a menu that looks
> > >about 2 x 2 pixels, and doesn't do anything, except go away like it should.
> > >
> > >
> > >
> > Yeah, I was seeing that also when I first was trying Gnome.Popup, I
> > worked around it by creating the menu in glade, and then attaching it.
> > My guess is that Gtk.Menu.Popup could be done in a similar way. I
> > haven't looked into it any more though.
> >
> > _______________________________________________
> > Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
--
McP <mariano.cano@hispalinux.es>