In my version of FW I made some modification that I think can be useful to others too.
1) In METHOD Paint() CLASS TListView I substituted:
- Code: Select all Expand view
- FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
with
- Code: Select all Expand view
- ::PaintBack( ::hDC )
to allow transparent ListView.
In this case You must call:
- Code: Select all Expand view
- ::oView:SendMsg(/*LVM_SETEXTENDEDLISTVIEWSTYLE*/0x1000+54, /*LVS_EX_TRANSPARENTBKGND*/0x00400000,/*LVS_EX_TRANSPARENTBKGND*/0x00400000)
or create it with LVS_EX_TRANSPARENTBKGND extended style. (It is a good idea)
2) Added method SetView:
- Code: Select all Expand view
- METHOD SetView(iView) INLINE LVSetView(::hWnd, iView )
with this code in c:
- Code: Select all Expand view
- HB_FUNC( LVSETVIEW )
{
#ifndef _WIN64
HWND hWnd = ( HWND ) hb_parnl( 1 );
#else
HWND hWnd = ( HWND ) hb_parnll( 1 );
#endif
DWORD nView = ( DWORD ) hb_parnl( 2 );
hb_retnl( ListView_SetView(hWnd, nView));
}
where view can be:
- Code: Select all Expand view
- #define LV_VIEW_ICON 0x0000
#define LV_VIEW_DETAILS 0x0001
#define LV_VIEW_SMALLICON 0x0002
#define LV_VIEW_LIST 0x0003
#define LV_VIEW_TILE 0x0004
3) Added method GetSelection
- Code: Select all Expand view
- METHOD GetSelection() INLINE LVGetSelection(::hWnd, iView )
with this code in c:
- Code: Select all Expand view
- HB_FUNC( LVGETSELECTION )
{
#ifndef _WIN64
HWND hWnd = ( HWND ) hb_parnl( 1 );
#else
HWND hWnd = ( HWND ) hb_parnll( 1 );
#endif
UINT nItem = ListView_GetItemCount(hWnd);
UINT nSel = ListView_GetSelectedCount(hWnd);
UINT i,j=0;
char bBuffer[ 250 ];
for(i=0;i<nItem;i++)
{
bBuffer[i] = ( ListView_GetItemState(hWnd, (int)i, LVIS_SELECTED) == LVIS_SELECTED)? '1' : '0';
}
hb_reta( nSel );
for(i=0;i<nItem;i++)
{
if( bBuffer[i] == '1')
{
hb_storvni( i+1, -1, j+1 );
j++;
}
}
}
(If I call ListView_GetItemState between hb_reta and hb_storvni it does not work... I don't know why, maybe someone can light me)
4) Set the group collapsible, it should be an option on the method InsertGroup.
I changed LVINSERTGROUP with this code:
- Code: Select all Expand view
grp.mask = LVGF_HEADER | LVGF_GROUPID | LVGF_FOOTER |LVGF_STATE;
grp.state = LVGS_COLLAPSIBLE;
grp.stateMask = LVGS_COLLAPSIBLE;
5) added this method to change text color:
- Code: Select all Expand view
- HB_FUNC( LVSETTEXTCOLOR )
{
#ifndef _WIN64
HWND hWnd = ( HWND ) hb_parnl( 1 );
#else
HWND hWnd = ( HWND ) hb_parnll( 1 );
#endif
COLORREF clrText = ( COLORREF ) hb_parnl( 2 );
hb_retnl( ListView_SetTextColor(hWnd, clrText));
}
Here my ListView:
PS: note the Explorer Theme