Board index » cppbuilder » TListView Column Width parameter not functioning
Benjamin Herreid
![]() CBuilder Developer |
TListView Column Width parameter not functioning2005-09-07 08:42:50 AM cppbuilder17 Hello, I am using BCB 6.0 with Update #4 installed on WinXP SP2. I am using a TListView (named RRFileList) with ViewStyle = vsReport with only one column. I would like the column to be at least as wide as the listview, but to automatically expand (and add a horizontal scrollbar) if longer items are added, and contract when they are removed (although I can live without the latter). I am initially setting the width as: RRFileList->Column[0]->Width = RRFileList->ClientWidth; Then when I add (or remove) an item: //autosize column RRFileList->Column[0]->Width = -1; //if column is smaller than window, cancel autosize and set width manually if(RRFileList->Column[0]->Width < RRFileList->ClientWidth) RRFileList->Column[0]->Width = RRFileList->ClientWidth; The problem I am having is that once I set the width parameter to -1, it stays at this value and does not change, thus the if statment always evaluates to true and the column never resizes. According to the BCB Help files, the read-only property WidthType is supposed to retain the -1 value, while width is supposed to reflect the actual current width of the column. This is not what seems to be happening... I have also tried setting the MinWidth property equal to RRFileList->ClientWidth but it will still autosize to less than this value. Any suggestions would be greatly appreciated. Thanks, -Benjamin Herreid |