Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TListView not displaying all of SubItem in a column


This question is answered.


Permlink Replies: 2 - Last Post: Feb 22, 2018 7:20 AM Last Post By: Clare Boddington
Clare Boddington

Posts: 2
Registered: 11/6/00
TListView not displaying all of SubItem in a column  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 21, 2018 9:33 AM
Hi

I have a vsReport style TListView with two columns. The text I want to display in the second column is quite long and I am unable to get it to display without the end being chopped off. Any ideas what could be wrong? There is plenty of space for it to be displayed and the full text is returned if I query the TListView in other ways. The text is also truncated when I hover over the column. I have tried messing about with the width settings.

Thanks
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TListView not displaying all of SubItem in a column [Edit]
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 21, 2018 11:10 AM   in response to: Clare Boddington in response to: Clare Boddington
Clare Boddington wrote:

I have a vsReport style TListView with two columns. The text I want
to display in the second column is quite long and I am unable to get
it to display without the end being chopped off. Any ideas what
could be wrong?

When the ListView queries your app for the column data, the buffer it
uses is limited to 260 chars, including a null terminator. By default,
TListView copies only as many chars as the buffer can hold.

There is plenty of space for it to be displayed and the full text is
returned if I query the TListView in other ways. The text is also
truncated when I hover over the column. I have tried messing about
with the width settings.

To get around the buffer length limitation, you need to either:

1. handle the ListView's LVN_GETDISPINFO notification yourself,
returning a pointer to the full text instead of copying it into the
default buffer (heed the warning in the LVN_GETDISPINFO documentation
about the memory lifetime of that pointer!).

2. owner-draw the ListView manually.

--
Remy Lebeau (TeamB)
Clare Boddington

Posts: 2
Registered: 11/6/00
Re: TListView not displaying all of SubItem in a column [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 7:20 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Solved this by drawing the ListView manually as suggested. Many thanks :)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02