[Gtk-sharp-list] Treeviews and popups, and easy way?

Anders Aagaard aagaande at gmail.com
Mon Jun 16 07:27:27 EDT 2008


Using ConnectBefore is fine when you dont need the treeview.selection data to
be up to date.  When you need it to be up to date, you have to manually make
sure the selection is correct, by using GetPathAtPos with X,Y coordinates,
which gets especially fun when your dealing with multiple selections.  And
that's hackish imo.

Making the columns clickable isn't really a solution for me, my popupbox
shows a file tree of files that are hidden from view (it's a media manager,
text files/subtitles etc are not visible in the normal view).

I've ended up making my own custom treeview, which means my monodevelop
views isn't as pretty, but atleast it works :)


Christian Hoff wrote:
> 
> Hi,
> 
> I had exactly the same problem(after a click with the right mouse button
> only the item that was clicked on remains selected). There are basically
> two ways two work around this problem: 
> 
> One would be to use the ConnectBefore attribute(overriding OnButtonPress
> won't work because it sometimes gets called afterthe TreeView processed
> the event and updated the selection). (In my opinion using the attribute
> isn't "hackish" at all)
> 
> Another one would be to drop the idea of the context menu and instead
> making the column titles clickable. The disadvantage is that this
> functionality won't be easy to discover. 
> 
> Christian Hoff
> 
> -------- Original-Nachricht --------
>> Datum: Fri, 13 Jun 2008 11:26:54 -0700 (PDT)
>> Von: Anders Aagaard <aagaande at gmail.com>
>> An: gtk-sharp-list at lists.ximian.com
>> Betreff: [Gtk-sharp-list]  Treeviews and popups, and easy way?
> 
>> 
>> Hi
>> 
>> I'm using monodevelop, and I have a treeview that needs to support
>> multiple
>> selections, and a popup menu.
>> 
>> I dont really want to make my own custom treeview and override
>> OnButtonPress
>> if I can avoid it, as I use monodevelop and it'd be a lot cleaner for me
>> to
>> keep the ui in the ui designer.
>> 
>> I've tried a few different solutions to work around this problem, mostly
>> [ConnectBefore] on my OnTreeviewButtonPress, and then a function that's
>> called immediatly to update the selected treeview based on
>> ButtonPressEventArgs, but this seems awfully hackish, and isn't reliable
>> (and since I switched to MultipleSelect, not really working at all).
>> 
>> Does anyone have any similar functions?  Preferably something that works,
>> I
>> just want to be able to get the currently selected rows from my
>> OnTreeviewButtonPressEvent.
>> 
>> Is there any clean way of implementing a popup menu in a treeview when
>> you
>> need to know the selection?  I've googled for hours now, and everything I
>> find is a ton of fairly hackish code.
>> 
>> Anders Aagaard
>> -- 
>> View this message in context:
>> http://www.nabble.com/Treeviews-and-popups%2C-and-easy-way--tp17829552p17829552.html
>> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 
> -- 
> GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
> Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 
> 

-- 
View this message in context: http://www.nabble.com/Treeviews-and-popups%2C-and-easy-way--tp17829552p17862360.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list