Re: "changed" signal operation for GtkTreeSelection



On Mon, 2004-02-02 at 17:31, Ron Lockwood-Childs wrote:
Hello,

I found in the FAQ information about capturing the occasion when a user 
selects a row in a ListStore -- providing a callback for the "changed" 
signal emitted by the GtkTreeSelection.  However, this is causing me 
grief in my current application, as I have witnessed the following behavior:

The ListStore in my application contains the contents of a directory. 
The current working directory can be altered by selecting one of the 
directories named in the list, which will replace the ListStore's 
contents with the contents of the selected directory.  Unfortunately, 
when I select an item from the list (which has no items currently 
selected), the application receives two "changed" events in a row: one 
for the very first item in the list, followed by the item the user 
selected -- that is, if it isn't the first item in the list.  I haven't 
any idea how to work around this behavior, since I can't know a priori 
whether the user will select the first item, and therefore immediately 
handle the signal and change the ListStore's contents; or the user will 
select an item further down in the list and I should ignore the first 
event (except in the simple case in which the list contains only a 
single item!).

Assistance/advice will be appreciated.

The thing to do, I think, would be subclass GtkTreeView and implement
your own widget_grab_focus method.  You could model it just like the
existing one, but not have it actually select the first row.  I found
this rather aggravating too actually.  I do wish there was an option for
this sort of behavior (or, really, just turn it off completely, it seems
to do more harm than good).

--
Ron Lockwood-Childs
VCT Labs, Inc.

-charlie




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