PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ListViewDemo - FireFly project to illustrate the ListView control  (Read 3249 times)

Jean-pierre Leroy

  • Senior Member
  • ***
  • Posts: 469
  • expect nothing, be prepared for everything ...

Dear FireFly users,

I'm am happy to share with you a sample FireFly project that illustrate some aspects of the ListView control; this project ListViewDemo illustrates how to ...

  1. ... sort a ListView (LVN_COLUMNCLICK notification)
  2. ... draw a down-arrow (or up-arrow) on the columns header to indicate that information in the ListView is sorted in descending order (ascending order)
  3. ... display a specific menu when the end-user click on the right mousse button over a ListView control (%WM_CONTEXTMENU & %WM_COMMAND messages)
  4. ... resize a ListView control proportionally to the size of the FORM (%WM_SIZE message)
  5. ... add a size-grip control on the right lower edge of a FORM
  6. ... restrict window/form resize to specific values (%WM_GETMINMAXINFO message)
  7. ... change the Backcolor or ForeColor of a complete row (%WM_NOTIFY message)
  8. ... display the number of selected rows in the ListView (LVN_ITEMCHANGED notification) *** NEW 04/24/2010 ***
  9. ... display the indexs of the selected rows in the ListView (ListView_GetNextItem with %LVNI_SELECTED) *** NEW 04/24/2010 ***


Notes:
   1. This project could be compiled with PowerBASIC Include files or Jose ROCA Includes files
   2. Most of the snippets in this project come from Paul and/or other PB users; I just try to put everything together on a sample project.
   3. This demo is not complete but could help some FF users to start with a ListView control.
   4. The module Module1.inc contains some specific functions that are necessary to compile this project; usually these functions are part of my own Functions Library; to avoid any conflict I use a prefix JPL_ for these functions in this project.
   5. The date in the second column is in french format JJ/MM/AAAA but could be easily adapted to other formats.
   6. This demo is a work in progress; I'm still trying to add a FILTERBAR for the ListView, any help about the FILTERBAR will be appreciated.
   
Your feedback is welcome
Jean-Pierre
« Last Edit: April 24, 2010, 10:53:03 AM by Jean-Pierre Leroy »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8822
  • Windows 10
    • PlanetSquires Software
Re: ListViewDemo - Sample FireFly project to demonstrate the ListView control
« Reply #1 on: November 11, 2009, 09:17:02 AM »

Excellent!

A lot of FF3 users will benefit from this example. Thanks for sharing!

Question: In your ListView_ColumnToSort, you select the first row in the Listview each time one of the columns are clicked. Not sure why you would do that. Maybe you can comment out the following line:

    ' pour sélectionner la première ligne du tableau
    FF_ListView_SetSelectedItem (hWndControl, 0)

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Jean-pierre Leroy

  • Senior Member
  • ***
  • Posts: 469
  • expect nothing, be prepared for everything ...
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #2 on: November 11, 2009, 09:30:39 AM »

Paul, you're right; I think it is a copy/paste error  ;) ... I've just corrected the function and uploaded again the ListViewDemo project.

Thanks,
Jean-Pierre
« Last Edit: November 15, 2009, 05:46:57 AM by Jean-Pierre Leroy »
Logged

Jean-pierre Leroy

  • Senior Member
  • ***
  • Posts: 469
  • expect nothing, be prepared for everything ...
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #3 on: November 14, 2009, 09:56:04 AM »

I've just updated the ListViewDemo to show how to :

7. ... change the Backcolor or ForeColor of a complete row (%WM_NOTIFY message) *** NEW 11/14/2009 ***

Jean-Pierre
« Last Edit: November 15, 2009, 05:47:13 AM by Jean-Pierre Leroy »
Logged

Jean-pierre Leroy

  • Senior Member
  • ***
  • Posts: 469
  • expect nothing, be prepared for everything ...
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #4 on: April 24, 2010, 10:39:43 AM »

Dear FireFly users,

I've just updated the ListViewDemo (FF Project available at the beginning of the thread) to show how to :

8. ... display the number of selected rows in the ListView (LVN_ITEMCHANGED notification) *** NEW 04/24/2010 ***
9. ... display the indexs of the selected rows in the ListView (ListView_GetNextItem with %LVNI_SELECTED) *** NEW 04/24/2010 ***


Any question, do not hesitate to ask.

Your feedback is welcome.
Jean-Pierre
Logged

Roger Garstang

  • Master Member
  • ****
  • Posts: 1360
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #5 on: April 27, 2010, 01:16:17 PM »

I must have missed when this was posted before.  Sort Arrows, row colors, and popup menu should be very useful. I've done ownerdrawn and sorted, but never used arrows or colors yet. Haven't had a request for popup menu so far, but sure I'll get one.
Logged

Jim Dunn

  • Junior Member
  • **
  • Posts: 111
  • Jim Dunn
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #6 on: December 16, 2013, 03:01:40 PM »

Jean-Pierre,

You have a gift for teaching, thx so much!
Logged
3.14159265358979323846264338327950
"Ok, yes... I like pie... um, I meant, pi."

SeaVipe

  • Junior Member
  • **
  • Posts: 170
  • Windows 10 Ubuntu 18
Re: ListViewDemo - FireFly project to illustrate the ListView control
« Reply #7 on: July 16, 2019, 03:02:21 PM »

Thank you, Jean-Pierre!
Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill