[MonoDevelop] Stetic add-in and treeview widget event question

Matze Braun matze at braunis.de
Sun Apr 9 09:01:16 EDT 2006


The problem with the code is that you have to use the
[GLib.ConnectBefore] attribute on the OnButtonPress handler. Otherwise
the treeview will eat the buttonpress and your custom handler won't run
anymore. I haven't used stetic yet and can't say if or how this is
possible in stetic.

Greetings,
	Matze

Am Sonntag, den 09.04.2006, 12:04 +1000 schrieb Paddy Joy:
> Sorry I attached the wrong code that time!
> 
> Paddy
> 
> > Hi,
> >
> > I have recently started playing with the new monodevelop stetic 
> > add-in, I'm very impressed, well done everyone!
> >
> > Just as a simple test what I am trying to do is add a treeview to my 
> > main window and then when a user clicks on a treeview item I want to 
> > take an action. So far my event handlers work ok for the 
> > KeyReleaseEvent but don't work for the ButtonPressEvent. These are the 
> > exact steps I'm doing in monodevelop:
> >
> > 1.      Create new gtk# project
> > 2.      Double click to open MainWindow in gui editor
> > 3.      Add treeview to main window
> > 4.      Click on signals tab
> > 5.      Under Common Widget Signals double click on KeyReleaseEvent to 
> > add event handler
> > 6.      Under Common Widget Signals double click on ButtonPressEvent 
> > to add event handler
> > 7.      Click on source tab to see code for MainWindow.cs
> > 8.      Add Console.WriteLine()'s to both handlers
> > 9.      Add some code to populate the treeview
> >
> >        TreeView                treeview1;
> > :
> > :
> > :
> > :
> >
> >        Gtk.ListStore musicListStore = new Gtk.ListStore (typeof 
> > (Gdk.Pixbuf),
> >                        typeof (string),  typeof (string));
> >
> >                treeview1.AppendColumn ("Icon", new 
> > Gtk.CellRendererPixbuf (), "pixbuf", 0);
> >                treeview1.AppendColumn ("Artist", new 
> > Gtk.CellRendererText (), "text", 1);
> >                treeview1.AppendColumn ("Title", new 
> > Gtk.CellRendererText (), "text", 2);
> >
> >                musicListStore.AppendValues (new Gdk.Pixbuf 
> > ("TreeViewRupertIcon.png"),
> >                        "Rupert", "Yellow bananas");
> >
> >                treeview1.Model = musicListStore;
> >
> > 10.     Compile and run project
> > 11.     Click on treeview item then press a key, text writen to 
> > console as expected
> > 12.     Click on item, no text writen to console
> >
> > It seems like my ButtonPressEvent handler is never being called. Am I 
> > doing something wrong here? I have attached some relevant code.
> >
> > Thanks,
> > Paddy
> >
> 
> einfaches Textdokument-Anlage (gui.stetic)
> <?xml version="1.0" encoding="utf-8"?>
> <stetic-interface>
>   <widget class="Gtk.Window" id="MainWindow" design-size="400 300">
>     <property name="Title" translatable="yes">MainWindow</property>
>     <property name="WindowPosition">CenterOnParent</property>
>     <property name="Visible">True</property>
>     <property name="Events">0</property>
>     <signal name="DeleteEvent" handler="OnDeleteEvent" />
>     <child>
>       <widget class="Gtk.TreeView" id="treeview1">
>         <property name="Visible">True</property>
>         <property name="CanFocus">True</property>
>         <property name="Events">0</property>
>         <signal name="RowActivated" handler="OnTreeview1RowActivated" />
>         <signal name="ButtonPressEvent" handler="ButtonPressEvent" />
>         <signal name="KeyReleaseEvent" handler="KeyReleaseHandler" />
>       </widget>
>     </child>
>   </widget>
> </stetic-interface>
> _______________________________________________ Monodevelop-list mailing list Monodevelop-list at lists.ximian.com http://lists.ximian.com/mailman/listinfo/monodevelop-list



More information about the Monodevelop-list mailing list