[MonoDevelop] Stetic add-in and treeview widget event question
Paddy Joy
mono at paddyjoy.com
Sat Apr 8 22:04:20 EDT 2006
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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainWindow.cs
Type: text/x-csharp
Size: 1336 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-list/attachments/20060409/91ebce45/MainWindow-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generated.cs
Type: text/x-csharp
Size: 2816 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-list/attachments/20060409/91ebce45/generated-0001.bin
-------------- next part --------------
<?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>
More information about the Monodevelop-list
mailing list