Actually by buffer I was meaning the space for the grid. Probably not needed, but if you use the API to size for your text and it still won't fit you could try adding 2-3 more to the width.
As for the buffer for the actual text, use a MAX_PATH ASCIIZ as MCM suggested, then You will be safe when you assign text to it. As for the API calls, usually they have a text length parameter and if not you need to figure out what they will be assigning and allow for it or risk it writting over your memory.
Announcement
Collapse
No announcement yet.
Listview_SetColumnWidth(hWnd, iCol, %LVSCW_AUTOSIZE_USEHEADER)
Collapse
X
-
Is there some off the wall value retrievable as a system setting that determines that "buffer" that listviews use on the column, or is it just part of the listview control?
BTW, if you encounter data too long for the supplied buffer very often, I think I might start looking at using something other than a listview control for that presentation.
MCM
Leave a comment:
-
GetTextExtentPoint32?
I hadn't thought to try that...
Is there some off the wall value retrievable as a system setting that determines that "buffer" that listviews use on the column, or is it just part of the listview control?
Leave a comment:
-
This could be useful too since XP Themes have an issue autosizing the first column correctly...could be your problem in sizing to begin with too. SP3 still hasn't fixed this, but Vista has.
There is an API to get the width needed to display a font of characters you pass it too if you aren't using it. May also be good to have a buffer for the grid of the cell too.
Leave a comment:
-
Or if the data width is less than header width, increase the width of the data.
In other words, a minimum width for data.
Leave a comment:
-
Originally posted by Adam J. Drake View PostWell, I've calculated the data width, and I'm trying to make sure that for 1 character columns, the 3-4 character column headers show...My data width calculation for 1 character columns doesn't even allow 1 character to show fully.
Leave a comment:
-
Well, I've calculated the data width, and I'm trying to make sure that for 1 character columns, the 3-4 character column headers show...My data width calculation for 1 character columns doesn't even allow 1 character to show fully.
Leave a comment:
-
Originally posted by Adam J. Drake View PostUsing LVSCW_AUTOSIZE_USEHEADER
Leave a comment:
-
Listview_SetColumnWidth(hWnd, iCol, %LVSCW_AUTOSIZE_USEHEADER)
Using LVSCW_AUTOSIZE_USEHEADER for ListView_SetColumnWidth, is it possible to somehow calculate what that width should be prior to setting the column width?
What I'm working on is creating a a display of sets of data where I have what each item's length is (giving me a sum total of the data length), and a column header as well for the ListView. The way I tried this at first was to proportionally size each column based on percentage of total data length, which works ok as long as the data length is not shorter than the column header.
I want to make sure the column header shows, and columns with 1 byte of data show, but I'm struggling for ideas on how to turn this into a 'dynamic" algorithm to handle most situations.
Any ideas or a shove in a different direction would be much appreciated.Tags: None
Leave a comment: