Forum > GTK

Capturing selection change in TListview (GTK signals)



Trying to debug some issues with GTK2 ListView relating to selection events.  In my code I've got all the kinks out of TListView with viewstyle set to vsReport (and I think vsList - the one which is just a one column, headerless treeview).  Now working on viewstyle set to vsIcon and vsSmallIcon.

I'm working with Lazarus 0.9.30 under Ubuntu 11.04 - 64bit version.

Here's what I've worked out so far, but I'm getting out of my depth a bit, and wouldn't mind some pointers from those in the know :-)

The unit I'm working in is

We're listening to the "selection-changed" signal when setting the GTK TreeView to Icon style.  My problem is this message is only being broadcast by the underlying GTK control when an item is selected.  We're not getting any notification of when an item is unselected.  This leads to issues with various listitems thinking they're still selected when we programmatically change selection.  (Interestingly I've only got to cycle over all ListItems and query their selected state to refresh their state, but that's a bit cumbersome for day to day use).

We're listening to the "changed" signal when setting the GTK TreeView to TreeView style.  In this model we're receiving both the select and unselect notifications.  This means the state of all the listitems within the TListView is maintained correctly.  The underlying GTK control is actually broadcasting way too many change messages (the GTK documentation acknowledges this), but by and large some smart code in prevents duplicate OnSelects from being called (at least for the selected item - extra unselects on the old selected item still slip through in one place).

So, I've been trying to connect to the "changed" signal for GTK TreeView set to Icon mode.  Unsuccessfully.    I'm persevering (it's all a good learning curve) but am hoping someone can tell me how to do it :-) 

Alternatively, is there a way of finding out what the OLD selected items where when a "selection-changed" signal is fired?

Also, I'm slowly coming up to speed with the GTK2 documentation.  What I'm looking for is a list of what triggers fire off each signal, but I can't seem to find this.  Does anyone know if this documentation exists anywhere?


So far, been completely unable to hook up "change", which is no surprise really - the GTK Icon View documentation doesn't list this signal.  All it lists is the signal we're using


[0] Message Index

Go to full version