Jump to content

Zero Width Column in ListView Control


Recommended Posts

I am using AutoIt to create a ListView control in a form. One of the columns in the control contains internal database ID's - something that the end user doesn't deal with and would know nothing about, but is very important to the logic in my program. Is it possible to set the width of a populated column in a ListView control to zero? This way I could access the value programmatically, but keep it hidden from users.

I think I could probably create a two-dimensional array of listview items, where one dimension stores the ListView item, and the other stores the internal db value. But I'd like to know if there's a simpler way to do it.

Thanks for your help!

Bob

Link to comment
Share on other sites

Global Const $LVM_SETCOLUMNWIDTH = 0x101E

;===============================================================================
;
; Description:              _GUICtrlListViewHideColumn
; Parameter(s):         $h_listview - controlID
;                               $i_col - column to hide (set width to zero)
; Requirement:              None
; Return Value(s):      Returns TRUE if successful, or FALSE otherwise
; User CallTip:         _GUICtrlListViewHideColumn($h_listview,$i_col) Hides the column "sets column width to zero" (required: <GuiListView.au3>)
; Author(s):                Gary Frost (custompcs at charter dot net)
; Note(s):              Idea from Holger
;
;===============================================================================
Func _GUICtrlListViewHideColumn($h_listview, $i_col)
    If IsHWnd($h_listview) Then
        Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_SETCOLUMNWIDTH, "int", $i_col, "int", 0)
        Return $a_ret[0]
    Else
        Return GUICtrlSendMsg($h_listview, $LVM_SETCOLUMNWIDTH, $i_col, 0)
    EndIf
EndFunc   ;==>_GUICtrlListViewHideColumn

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...