Re: [gtkmm] The TreeView blues..



Am Mit, 2002-12-04 um 04.47 schrieb Kjell Irgens:
> 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.

Please don't try to hack around the accessibility efforts.

> 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?  

Unfortunately you didn't tell us what 'selected' means in your program. 
Would it be OK for you to use a Gtk::CellRendererToggle to indicate that
state (and perhaps even switch to single selection mode)?

--Daniel





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