Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

ListView and autosize

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to Hans-Peter Diettrich: I've just uploaded an patch (#19303), that allows to use the remaining space for the…
Hans-Peter Diettrich wrote 6 lines
I've just uploaded an patch (#19303), that allows to use the remaining space for the rightmost list column. I use it to e.g. enlarge the Function column in the CallStack, to show as many parameters as possible. Perhaps somebody wants to improve this hack, so that it better fits into the AutoSize model.

I haven't looked at your patch, but I have done something like this ages ago in fpGUI too. Just remember to take the width of a vertical scrollbar into account too. :)

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Hans-Peter Diettrich

I've just uploaded an patch (#19303), that allows to use the remaining space for the rightmost list column. I use it to e.g. enlarge the Function column in the CallStack, to show as many parameters as possible.

Perhaps somebody wants to improve this hack, so that it better fits into the AutoSize model.

DoDi

Reply by email

Hans-Peter Diettrich
to Vincent Snijders: 2011/5/8 Hans-Peter Diettrich : I think the patch is wrong. See comment on the bug…
Show quoted text 5 lines
2011/5/8 Hans-Peter Diettrich : > I've just uploaded an patch (#19303), that allows to use the remaining space > for the rightmost list column. I think the patch is wrong. See comment on the bug tracker.

If it's only the property name, then feel free to give it a new name...

How would you tell the users, that a column width of -2 means auto-expand? The widget sets are not affected, btw.

ChildSizing might be a solution, too, but it interferes with TListColumns. And I don't know how to make it work...

DoDi

Reply by email

Graeme Geldenhuys
to Hans-Peter Diettrich: Okay, that's a Windows specific convention. Unfortunately it is not documented in a way…
Hans-Peter Diettrich wrote 6 lines
> http://msdn.microsoft.com/en-us/library/bb761163%28v=vs.85%29.aspx > > The value of LVSCW_AUTOSIZE_USEHEADER is -2. Okay, that's a Windows specific convention. Unfortunately it is not documented in a way that allows to implement it for other widgetsets.

+1
Such Windows-ism doesn't belong in a cross-platform cross-widgetset library.

As for a simple solution, and which makes it very clear for the developer what is happening, why not apply that option to the listview, not per column.

eg:
   ListView.Options := ListView.Options + [lo_AutoSizeLastColumn];

lo = "listview option". I didn't check if the ListView already has a Options property. I know the StringGrid has, and that is where such things are defined for the StringGrid. Make sense to me to do similar for the ListView.

Just my 2? worth...

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Hans-Peter Diettrich
to Vincent Snijders: 2011/5/9 Hans-Peter Diettrich : http://msdn.microsoft.com/en-us/library/bb761163%28v=vs.85…
Show quoted text 6 lines
2011/5/9 Hans-Peter Diettrich : > How would you tell the users, that a column width of -2 means auto-expand? http://msdn.microsoft.com/en-us/library/bb761163%28v=vs.85%29.aspx The value of LVSCW_AUTOSIZE_USEHEADER is -2.

Okay, that's a Windows specific convention. Unfortunately it is not documented in a way that allows to implement it for other widgetsets. E.g. what shall happen if a user tries to apply it to multiple columns? What size should be assigned to the previous auto-expand column, when another column becomes auto-expand?

A proper implementation IMO should implement the AutoSize (and other) features in a widgetset independent way, e.g. in the TWSCustomListView base class, for use in all widgetsets that don't support a feature natively. This implementation defines what behaviour the user can expect in every widgetset, as long as according documentation is missing.

In a portable environment there exist chances for incompatible implementations of similar or essentially the same features, in different widgetsets. The use of widgetset-specific features should be allowed, of course, at the risk of the user; this means that the boolean TListColumn.AutoSize property should be retyped, e.g. into an enum. Otherwise it would be a good idea to add portable properties to the ListView control itself, with an also portable implementation.

One such portable property could be what I tried to implement, an automatic expansion of the rightmost column. A more flexible implementation could specify a column that should be auto-expanded (kind of alClient), with proper handling of column reordering. In any case the implementation (calculation of concrete column widths) can reside entirely in the control, without any special widgetset support.

DoDi

Reply by email