• Welcome to PlanetSquires Forums.
 

ListViewDemo - FireFly project to illustrate the ListView control

Started by Jean-pierre Leroy, November 11, 2009, 07:42:15 AM

Previous topic - Next topic

Jean-pierre Leroy

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

Paul Squires

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)

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Jean-pierre Leroy

#2
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

Jean-pierre Leroy

#3
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

Jean-pierre Leroy

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

Roger Garstang

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.

Jim Dunn

3.14159265358979323846264338327950
"Ok, yes... I like pie... um, I meant, pi."

SeaVipe

Clive Richey