Page 1 of 1

Columns.Add and resizable

Posted: 01 Jun 2010, 10:01
by Mex
Hello Timo!

When i add columns and set the resizable = False, it does not work i can still change columns width.
Is this a bug or am i missing something? (Windows 7)


Alles gute;
Meelis

Re: Columns.Add and resizable

Posted: 01 Jun 2010, 11:11
by Mex
Ok its working nut not as i expected :)
Let's say i have 3 columns
First columns width is set to 0 and resizable to False.
2 other columns are lets say 200px.(see pics)

With mouse i can still change first columns width and now when its visible then its "locked".


BR;
Meelis

Re: Columns.Add and resizable

Posted: 01 Jun 2010, 11:17
by Mex
Ok found a solution how to "lock" hidden column, but dont know if this is a right way :)

Private Sub theList_ResizingColumn(ByVal column As ExLVwLibUCtl.IListViewColumn, newColumnWidth As Long, abortResizing As Boolean)
If column.Width = 0 Then
newColumnWidth = 0
End If
End Sub

Re: Columns.Add and resizable

Posted: 01 Jun 2010, 17:49
by TiKu
This sounds like a bug of comctl32.dll, but I'll check (not today).

To comment your work-around: Why don't you set abortResizing to True?

Re: Columns.Add and resizable

Posted: 04 Jun 2010, 22:42
by TiKu
I can confirm that this is a bug in comctl32.dll. You've already found the best work-around (except for the abortResizing thing).

Re: Columns.Add and resizable

Posted: 23 Feb 2013, 01:05
by engee30
Hi

I have a little problem dealing with columns, or rather headers. Once you drag one of the headers, its position changes, but the header index remains the same. Say, I've got three columns. When in normal order, Header indexed 0 is in Position 0, Header indexed 1 in Position 1, and Header indexed 2 in Position 2. If I drag Header indexed 1 into Position 0, it obviously retains the index 1, and changes its position from 1 to 0. Is it possible for the dragged header to change its index as well? I would like to iterate and print the the names of the headers in the order they are positioned, and not according to their indices, in a loop like:

Code: Select all

Dim a as Long
for a = 0 to lvw.columns.count -1
Print lvw.columns(a).caption
next
This way, you'll get:
"Header Caption 0"
"Header Caption 1"
"Header Caption 2"

but I'd like to get:
"Header Caption 1" (dragged from position 1 to 0)
"Header Caption 0" (moved from position 0 to 1)
"Header Caption 2" (remained the same)
:x

Regards
Pete

Re: Columns.Add and resizable

Posted: 23 Feb 2013, 01:36
by TiKu
The index cannot be changed, but you can access the headers by position:

Code: Select all

Dim a as Long
for a = 0 to lvw.columns.count -1
Print lvw.columns(a, citPosition).caption
next
By the way, if you need this in order to persist the column order, you should think about using the Columns.PositionsString property instead.

Regards
TiKu

Re: Columns.Add and resizable

Posted: 23 Feb 2013, 15:40
by engee30
Oh, that was another simple, yet perfect solution. Thanks again. :D
Pete