MELeBlanc
asked on
Locking width on Listview colums
I have a listview control that has a number of columns.. I want to be able to disable the ability to resize the width of these columns. How does one go about doing this?
-M
-M
check out: http://www.codeguru.com/vb/articles/htm/LVTricks.shtml
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might want to trap other clicks.. such as the mouse double click since that also resizes the windows...
so you would need to add something like this...
Public Const WM_LBUTTONDBLCLK = &H203
If uMsg = WM_LBUTTONDOWN or uMsg = WM_LBUTTONDBLCLK Then
Debug.Print "button down"
Exit Function
End If
so you would need to add something like this...
Public Const WM_LBUTTONDBLCLK = &H203
If uMsg = WM_LBUTTONDOWN or uMsg = WM_LBUTTONDBLCLK Then
Debug.Print "button down"
Exit Function
End If
bobbit, the link only shows how to avoid resize dragging but not prevents from resizing with double click.
The link for the ocx is broken, i found it in another place:
http://www.geocities.com/CapeCanaveral/6740/subcls32.zip
The link for the ocx is broken, i found it in another place:
http://www.geocities.com/CapeCanaveral/6740/subcls32.zip
Code for aeklund shold works with a little modification to last code posted by him:
Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_LBUTTONDOWN
Debug.Print "button down"
uMsg = 0
Case WM_LBUTTONDBLCLK
Debug.Print "Double click"
uMsg = 0
End Select
WindowProc = CallWindowProc(lpPrevWndPr oc, hw, uMsg, wParam, lParam)
End Function
Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_LBUTTONDOWN
Debug.Print "button down"
uMsg = 0
Case WM_LBUTTONDBLCLK
Debug.Print "Double click"
uMsg = 0
End Select
WindowProc = CallWindowProc(lpPrevWndPr
End Function
Mel, if code posted by me works for you, DON'T ACCETP IT as an answer.
Cheers
Cheers
Richie,
What is the advantage of setting the uMsg = 0 and letting it go back to the original window compared to just exit the function and send nothing to the original window?
What is the advantage of setting the uMsg = 0 and letting it go back to the original window compared to just exit the function and send nothing to the original window?
ASKER
That would be exactly what I am looking for! Thanks!
-M
-M
doing that way, we don't have exit the function and let pass all messages to original window proc. I think it is less intrusive that way. That's all.
Your welcome... Good luck!