Recent

Author Topic: ListView do not show icons in Linux when ViewStyle:=vsIcon  (Read 15858 times)

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
ListView do not show icons in Linux when ViewStyle:=vsIcon
« on: April 15, 2010, 04:21:23 am »
Control Listview works OK under Windows and behaves very bad in Linux. And some people have reported bad icon management of ListView in Mac OS.

This bug has more than 1 year without solution from Lazarus developer team.

I have reported newly this in:
http://bugs.freepascal.org/view.php?id=16238

The scenario is this:

    I have a ListView named ListView1 , two buttons Button1 and Button2,
two imagelist, ImageList1 and ImageList2.

ImageList1 contains 3 .png images of 16x16 pixels, Image2 has 3 .png of 48x48 pixels.

ListView has 3 items. It is configured to show 1 column in report mode.

ListView1 has SmallImages:=ImageList1 and LargeImages:=ImageList2.
Button1Click has only 1 line of code: ListView1.ViewStyle:=vsReport;
Button2Click has only 1 line: ListView1.ViewStyle:=vsIcon;

In Linux, the ListView do not show icons in mode vsIcon;
in Windows, same code show icons correctly.

In mode vsSmallIcons the control do not show anything (in Linux).

The problem occurs in Lazarus 0.9.28.2 beta with FPC 2.2.4 in Ubuntu 9.10 and in Puppy Linux 4.3.1. And was reported by another user using Lazarus 0.9.29 with FPC 2.5.1. I am convinced that it is not caused by gtk version. I think that the problem is a bug in ListView LCL component for Linux. Please correct me.

Does anybody know a workaround? Maybe some similar control
that can show icons in a list of elements in Linux?

Can contact me at: alejandro.lavarello (at) gmail . com
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #1 on: April 15, 2010, 08:22:17 am »
The listview problem can't be easy fixed. vsIcon listview style is simple not implemented for gtk2. Only vsReport style works. This is not a bug but a missing feature. Gtk has a GtkIconView widget which can be used for vsIcon style but again this is not implemented in LCL.

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #2 on: April 15, 2010, 01:32:45 pm »
The listview problem can't be easy fixed. vsIcon listview style is simple not implemented for gtk2. Only vsReport style works. This is not a bug but a missing feature. Gtk has a GtkIconView widget which can be used for vsIcon style but again this is not implemented in LCL.
I am a newbie in Lazarus.
Seeing in the Lazarus bugtracker, I have show that some controls have been
improved to work with some operating systems or widgetset to work equal
to Windows equivalent, but ListView still working bad in Linux.

Can you show me some workaround? Maybe not using Gtk2... Or some similar control for Lazarus...

I use Ubuntu 9.10 and Puppy Linux 4.3.1 for Lazarus development. Ubuntu 9.10 and Puppy has lot of applications (not developed in Lazarus) using
controls similar to ListView , working well in vsIcon style. Should I switch to another programming language?
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #3 on: April 16, 2010, 01:15:09 am »
Instead of switching to another language you can try to implement the missing style support for gtk2. You have all the sources of Lazarus so nothing stops you to start hacking the code right now :)

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #4 on: April 16, 2010, 03:30:40 am »
Instead of switching to another language you can try to implement the missing style support for gtk2. You have all the sources of Lazarus so nothing stops you to start hacking the code right now :)
Thanks Paul! Very helpful! (ironic)
I do not know how to rebuild a component.
I have believed in the Lazarus motto "write once, compile everywhere".
But you show me that this is false. It is "use Windows, or you can
still for years that Lazarus team correct bugs in Linux".
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #5 on: April 18, 2010, 08:11:56 am »
Quote
Thanks Paul! Very helpful! (ironic)
I do not know how to rebuild a component.

Never late to study. Lazarus project needs more contributors. And you had a chance to become one.

Quote
I have believed in the Lazarus motto "write once, compile everywhere".But you show me that this is false.

Did you see the Lazarus version is called beta? This means that not everything we planed for 1.0 is ready. ListView is one of such things -  it is very complex control.

Quote
It is "use Windows, or you can still for years that Lazarus team correct bugs in Linux".

How you imagine the Lazarus team? Is that 100 developers in your opinion? Or even 20 full-day working developers? No. We have no full-day developers. We are doing the development in our free time. We don't state that everything is ready but many things are ready for use.

Anyway, it took me only few hours to implement vsIcon, vsSmallIcon styles for gtk2. Update your lazarus to r24688 if you want to test this.

Zoran

  • Hero Member
  • *****
  • Posts: 1468
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #6 on: April 18, 2010, 10:16:07 am »

Anyway, it took me only few hours to implement vsIcon, vsSmallIcon styles for gtk2. Update your lazarus to r24688 if you want to test this.

I don't need this particular improvement right now, but I need to say that seeing the way this topic finishes really helps keeping people tied to Lazarus!

Bravo, Paul!

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #7 on: April 19, 2010, 04:58:48 pm »
Paul, first at all, thanks for try to correct the ListView Lazarus bug.
Yes, I know that Lazarus, like all software libre, is done by volunteers, and nobody can require support.
I will try your fix; because I do not know how to update using SVN files, I am downloading lazarus-0.9.29.24707-20100419.i386.deb.tar and I hope this can be installed in my Ubuntu 9.10 PC. (This file contains your fix? )
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3653
  • I like bugs.
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #8 on: April 19, 2010, 06:02:48 pm »
I will try your fix; because I do not know how to update using SVN files ...

Did you search the wiki? Here it is:
 http://wiki.lazarus.freepascal.org/Getting_Lazarus#Using_SVN

Basically just one command to get the SVN trunk version:
 svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

Juha

Zoran

  • Hero Member
  • *****
  • Posts: 1468
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #9 on: April 19, 2010, 08:48:08 pm »
Paul, first at all, thanks for try to correct the ListView Lazarus bug.
Yes, I know that Lazarus, like all software libre, is done by volunteers, and nobody can require support.
I will try your fix; because I do not know how to update using SVN files, I am downloading lazarus-0.9.29.24707-20100419.i386.deb.tar and I hope this can be installed in my Ubuntu 9.10 PC. (This file contains your fix? )

Yes, because its build with revision 24707 (the number is contained in the file name), and Paul said the fix is added to 24688.

You really don't need to update directly from svn. Each night a new snapshot is built. So, you can always download a revision not older than 24 hours in deb file.

Just note that you first need to install fpc 2.4.0 (it's a stable release, you need not change it then) in order to install Lazarus 0.9.29. You can find it in deb archive too.

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #10 on: April 20, 2010, 12:55:47 am »
I would recommend to use svn for testing. Snapshots are for lazy people who want to look only once at the development version and forget about it. If you want to stay with development version then typing "svn up; make bigide" the next time you want to look at changes are easier then downloading another snapshot and installing it.

jhmos

  • New Member
  • *
  • Posts: 24
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #11 on: April 20, 2010, 04:34:53 am »
I would recommend to use svn for testing. Snapshots are for lazy people who want to look only once at the development version and forget about it. If you want to stay with development version then typing "svn up; make bigide" the next time you want to look at changes are easier then downloading another snapshot and installing it.

Hey, I'm even lazier than that, haven't try a development version for quite a while. I do feel a little guilty not making any contribution to Lazarus, could do testing at least. Would this be a good time (before 0.9.30) to try out my working projects with the latest svn version?

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #12 on: April 20, 2010, 12:29:01 pm »
Quote
Would this be a good time (before 0.9.30) to try out my working projects with the latest svn version?

Yes, now is a much better time than a week or 2 weeks ago.

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #13 on: April 22, 2010, 12:28:30 pm »
Thanks to Paul Ishenin, ListView has been improved in Linux, but still with a minor problem.
When one change ViewStyle , the change do not apply, even if usign Refresh method.

Supposed that ListView1 has ViewStyle:=VsIcon and you want to change to
VsSmallIcon. This code do not work:

 ListView1.ViewStyle :=VsSmallIcon ;
 ListView1.Refresh; // still showing VsIcon mode

Workaround: Change twice ViewStyle

 ListView1.ViewStyle:=VsList;
 ListView1.ViewStyle:=VsSmallIcon;
 ListView1.Refresh ; // now, ListView1 is showing VsSmallIcon mode.

Tested in Ubuntu 9.10 with:
 Lazarus 0.9.29   date 2010-04-21
 FPC: 2.4.0
 Revision SVN: 24789
 i386-linux-gtk 2 (beta)
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: ListView do not show icons in Linux when ViewStyle:=vsIcon
« Reply #14 on: April 23, 2010, 01:56:42 am »
Please report to the bug tracker with the small test application.