Solved

List View cell size limit?

Posted on 1998-07-22
3
360 Views
Last Modified: 2012-05-04
Is there a limit to the number of characters a list view cell can display? It appears the limit is 255?
0
Comment
Question by:rascal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1168383
Try using the ListView_GetStringWidth() and ListView_SetColumnWidth() macros.


The ListView_GetStringWidth macro determines the width of a specified string, using the specified list view control's current font. You can use this macro or explicitly send the LVM_GETSTRINGWIDTH message.

int ListView_GetStringWidth(
    HWND hwnd,       
    LPCSTR psz      
   );      
 
Parameters
hwnd - Handle to the list view control.
psz - Pointer to a null-terminated string.
 
Return Values - Returns the string width if successful or zero otherwise.


The ListView_SetColumnWidth macro changes the width of a column in report or list view. You can use this macro or explicitly send the LVM_SETCOLUMNWIDTH message.
BOOL ListView_SetColumnWidth(
    HWND hwnd,       
    int iCol,       
    int cx      
   );      
 
Parameters
hwnd - Handle to the list view control.
iCol - Index of the column. In list view, the iCol parameter must be -1.
cx - New width of the column, in list view coordinates, or one of the following values:
LVSCW_AUTOSIZE - Automatically sizes the column.
LVSCW_AUTOSIZE_USEHEADER - Automatically sizes the column to fit the header text.

0
 
LVL 1

Author Comment

by:rascal
ID: 1168384
Thanks, but I need to know if there is an upper limit that the column display. I will try the sample code you provided with various length strings but I need to know if there is an explicit upper boundary of length a list view column can support. Thanks again.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1168385
Actually, there is a limit because the argument to LVM_SETCOLUMNWIDTH is a positive WORD.  Thus the limit is 32K pixels.  The number of characters depends on the font.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question