Dear Xailer user,
Today I want to talk about the control TListView. That great unknown 😉 This control is typical of the Windows API and basically is a Browse that allows you to display the information in the same way as the file explorer in Windows itself. It has the following types of view: Icon, small Icon, List, Tile and Details.
The Browse (TBrowse and its inherited) that incorporates Xailer looks like a TListView with ‘Details’ view. When we want to display information that way, with grid style, Xailer browse is infinitely more powerful than TListView. However, there are times when the TListView may be a better candidate for the data to display. Obviously when you prefer a view different from ‘Details’, but also can be a great candidate when you need to group the different elements of the browse or display a ‘checkbox’ in each one.
Until Xailer 5 the control was quite limited since you could not customize almost anything, but now it has completely improved its functionality allowing you to do things like this:
And this has been all the code needed to get it:
METHOD ListView1DrawCell( oSender, oItem, nColumn, nClrText, nClrPane, hDC, aRect ) CLASS TForm1 LOCAL nWidth IF nColumn == 0 RETURN 0 // Notify columns one by one ELSEIF nColumn == 1 SelectObject( hDC, ::oFontBold:Handle ) ELSE SelectObject( hDC, ::oFont:Handle ) IF nColumn == 5 InflateRect( aRect, -1, -1 ) nWidth := Int( ( aRect[ 3 ] - aRect[ 1 ] ) * oItem:aData[ 4 ] / ::nMaxSize ) aRect[ 3 ] := aRect[ 1 ] + nWidth FillRect( hDC, aRect, ::oBrushGauge:Handle ) RETURN 2 // Do not paint anything ENDIF ENDIF RETURN Nil
As you see all your get overloading your OnDrawCell event that is very easy to do. I hope you like this important improvement that I made to the control. I encourage you to start using the TListView control as soon as possible.