Jump to content
Sign in to follow this  
Anteaus

Truncated listview items

Recommended Posts

Anteaus

Re this thread:

http://www.autoitscript.com/forum/index.php?showtopic=9159

it seems to me that increasing the overall listview width is not the answer. Even when MUCH wider than the sum total of any displayed items, all of the items are still truncated.

A VB forum suggest that a property exists for the listview-column width, but the method used in VB is clearly not applicable here.

I need to solve this one because the data I'm displaying consists of directory trees in which the first part is always identical. Thus, the truncated listing is meaningless. OK, so the user can get it into some sort of readable format by dragging the headers but it looks a hell of a mess, and this has to be done every time the data is presented, since a GUI redraw will re-truncate the columns.

Example:

$lv=GUICtrlCreateListView (" Profile Image Path | User Account ",10,10,800,600)

$lv1=GUICtrlCreateListViewItem("C:\Documents and Settings\UserOne.Domain | MyData",$lv)

$lv2=GUICtrlCreateListViewItem("C:\Documents and Settings\UserTwo.Local | YourData",$lv)

Displays:

Profile Image Path |User Account

C:\Documents and Setting... MyData {Large whitespace}

C:\Documents and Setting... YourData {Large whitespace}

BTW, tried increasing the header widths, or padding the header with tabs. Then they got truncated too. :P

-any ideas?

Tested on XP SP3, Autoit 3.2.12.0

Share this post


Link to post
Share on other sites
Zedna

#include <ListViewConstants.au3>

$lv=GUICtrlCreateListView (" Profile Image Path | User Account ",10,10,800,600)
$lv1=GUICtrlCreateListViewItem("C:\Documents and Settings\UserOne.Domain | MyData",$lv)
$lv2=GUICtrlCreateListViewItem("C:\Documents and Settings\UserTwo.Local | YourData",$lv)
GUICtrlSendMsg($lv, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE)

Edited by Zedna

Share this post


Link to post
Share on other sites
Anteaus

Thanks, this makes a significant improvement, data is now readable.

The remaining problem is that the column headers are also being truncated, seemingly for no reason. For example even the word 'Host' is truncated when the hostnames are shorter than 5-6 letters. Any ideas how to solve this one? (tried $LVSCW_AUTOSIZE_USEHEADER)

Share this post


Link to post
Share on other sites
Anteaus

GUICtrlSendMsg($lv, $LVM_SETCOLUMNWIDTH, 0, 70); 70 is width of column 0 in pixels
Ah, I see. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×