Re: [gtkmm] The TreeView blues..



On Wed, Dec 04, 2002 at 12:03:52AM +0100, Daniel Elstner wrote:
> > Also, if I unexpand a parent row where there are selected children, these
> > seem to be unselected automatically.  This is not what I expected  would
> > happen, can it be avoided?
> 
> No.  That's intented behaviour.  (hint: accessibility -- the current
> selection should always be clearly visible)
> 
> As I understand it, you probably want to handle rows with subnodes as a
> whole (like e.g. copying a directory).  That's OK, and should be easy
> enough to handle programatically.

The main reason I want to use a tree and not a list in this case is just that,
to hide the details of which files are selected or not.  I have a set of
directories which all contains a relatively large number of files.

I want the user to be able to expand a directory and do file selecting in
there, and then unexpand it again.  I plan to indicate the number of files
selected in the directory row.

What I have done now is to add a custom "bool selected" to the model, and
update this when selection changes.  Then I connect to row_expand, and
select the correct files.  A problem arised, of course.  When the directory
row is unexpanded, all the files are unselected automatically.  I can't think
of a way to differentiate this from the user unselecting the files himself.

Next I thought of handling all the selecting myself, by:
tree_view.signal_button_press_event().connect(
	slot (*this, &TreeList::on_button_pressed), false);
and then returning true from on_button_pressed().  But this won't work
since the button presses intended for the expand/unexpand symbol won't go
through.

Anyone have any suggestions?  


> > I would also like to have a popup menu when I press e.g. mouse button 3 over
> > a row.  I can make this work by following the description in
> > http://mail.gnome.org/archives/gtkmm-list/2002-November/msg00146.html
> > But I need to know the row over which the mouse button was clicked, can this
> > information be found somehow?
> 
> See Gtk::TreeView::get_path_at_pos() (you need to pass the coordinates
> from the event struct to this method).

This really helped me, thank you.

-- 
--Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]