View Issue Details

IDProjectCategoryView StatusLast Update
0007938Lazarus-public2011-11-20 10:30
Reporterda_Seeb Assigned ToZeljan Rikalo  
Status resolvedResolutionfixed 
Summary0007938: Listview column autosize gtk2
Descriptionautosizing the columns of a TListview only works using gtk2 when the listitems are edited without using BeginUpdate/EndUpdate.
So it takes a long time to add or remove many items.
Fixed in Revision33638
WidgetsetGTK 2
Attached Files


related to 0012533 closedFelipe Monteiro de Carvalho Listview autosize does not work. 
related to 0007937 closedFelipe Monteiro de Carvalho Listview column autosize win32 



2006-12-08 15:37

reporter   ~0010265

to be more specific:
only when TListview.Items.Clear is called between BeginUpdate/EndUpdate autosizing is broken.

indeed if I do


//adding/editing items here


everything is working fine

Felipe Monteiro de Carvalho

2007-05-09 10:51

developer   ~0012556

This is a gtk2 bug, but because there is a simple work around for it, I set the target for post 1.2

Felipe Monteiro de Carvalho

2008-04-16 02:10

developer   ~0018836

Please submit a test project.

Vincent Snijders

2008-05-23 12:32

manager   ~0019627

No feedback from reporter.


2008-08-10 23:15

reporter   ~0021204

here is an example project.

press "long" button to creat elong items, "short" button to create short items. Listview columns are not resized after creating long items. Also prints some GTK-Critical errors.

2008-08-10 23:15


LVautosize.tar.gz (2,469 bytes)

Zeljan Rikalo

2011-07-06 17:38

developer   ~0049730

Issue still exist ... tested with Lazarus 0.9.31 r31572 FPC 2.4.3 i386-linux-gtk 2


2011-08-12 00:17

developer   ~0050737

The problem is the GtkListModel is detached/attached from the the GtkTreeView when BeginUpdate/EndUpdate is called. This is to avoid the GtkTreeView from doing unnecessary work while adding the items. The GtkTreeView does not re-evaluate all the items in the list when the GtkTreeModel is assigned. I'm not sure of a way to avoid this without cripling beginupdate/endupdate for gtk2.

It may be worth benchmarking adding items with different versions of gtk2 to see what the performance impact is when begin/endupdate is disabled. It may be small with newer versions vs older versions.

Mike Thompson

2011-08-16 07:50

developer   ~0050861

The patch I submitted to did some work on the gtk2 ListView EndUpdate. Nothing that would affect this issue - but I suspect it'll be the same sort of change required, and just letting anyone know who may work on EndUdpate of other issues. Essentially the detaching of the model prevented the TListView from being updated with state (selection) changes.

With 0.9.30, all I needed to do was call RecreateWnd as the last item in EndUdpate - this, and some broadcast blocking code, was sufficient for the gtk2 widget to be recreated according to the state of the LCL TListView. Didn't work with 0.9.31 for some reason, so I had to put some manual sync code in EndUpdate...

Zeljan Rikalo

2011-10-30 13:49

developer   ~0053636

Yes. recreateWnd will do the job since new column width is in game. That's not solution.

Zeljan Rikalo

2011-11-20 10:29

developer   ~0054288

Please test and close if ok.

Issue History

Date Modified Username Field Change
2006-12-08 15:20 da_Seeb New Issue
2006-12-08 15:20 da_Seeb Widgetset => GTK 2
2006-12-08 15:37 da_Seeb Note Added: 0010265
2006-12-08 15:50 Vincent Snijders LazTarget => post 1.0
2006-12-08 15:50 Vincent Snijders Status new => acknowledged
2007-05-09 10:51 Felipe Monteiro de Carvalho LazTarget post 1.0 => post 1.2
2007-05-09 10:51 Felipe Monteiro de Carvalho Note Added: 0012556
2008-04-12 12:26 Felipe Monteiro de Carvalho Tag Attached: gtk2
2008-04-16 02:10 Felipe Monteiro de Carvalho LazTarget post 1.2 => 1.2
2008-04-16 02:10 Felipe Monteiro de Carvalho Note Added: 0018836
2008-04-16 02:10 Felipe Monteiro de Carvalho Status acknowledged => feedback
2008-05-23 12:32 Vincent Snijders Status feedback => resolved
2008-05-23 12:32 Vincent Snijders Resolution open => unable to reproduce
2008-05-23 12:32 Vincent Snijders Assigned To => Vincent Snijders
2008-05-23 12:32 Vincent Snijders Note Added: 0019627
2008-08-10 23:15 da_Seeb Status resolved => assigned
2008-08-10 23:15 da_Seeb Resolution unable to reproduce => reopened
2008-08-10 23:15 da_Seeb Note Added: 0021204
2008-08-10 23:15 da_Seeb File Added: LVautosize.tar.gz
2008-08-11 00:47 Vincent Snijders Assigned To Vincent Snijders =>
2008-08-11 00:47 Vincent Snijders Status assigned => acknowledged
2008-10-31 09:20 Vincent Snijders Relationship added related to 0012533
2010-04-27 04:27 Paul Ishenin Relationship added related to 0007937
2011-07-06 17:38 Zeljan Rikalo Note Added: 0049730
2011-08-12 00:17 AndrewH Note Added: 0050737
2011-08-16 07:50 Mike Thompson Note Added: 0050861
2011-10-30 13:49 Zeljan Rikalo Note Added: 0053636
2011-11-20 10:29 Zeljan Rikalo Fixed in Revision => 33638
2011-11-20 10:29 Zeljan Rikalo Status acknowledged => resolved
2011-11-20 10:29 Zeljan Rikalo Resolution reopened => fixed
2011-11-20 10:29 Zeljan Rikalo Assigned To => Zeljan Rikalo
2011-11-20 10:29 Zeljan Rikalo Note Added: 0054288