jeansaad Posted June 7, 2005 Share Posted June 7, 2005 Does anyone know how to resize columns based on the ListViewItem data so that everything in the ListView shows on the screen? When I resize the columns the GUI gets distorted and doesn't refresh properly... The ListViews are in tabs... expandcollapse popup#include <GuiConstants.au3> #NoTrayIcon ; ---------------------------------------------------------------------------- ; Create the GUI features ; ---------------------------------------------------------------------------- $WinTitle = 'FindStuff!' $WinWidth = 650 $WinHeight = 600 ;GUI GUICreate($WinTitle, $WinWidth, $WinHeight) GuiSetIcon('icon.ico', 0) ;FILE MENU $FileMenu = GuiCtrlCreateMenu ("File") $ExitItem = GuiCtrlCreateMenuitem ("Exit", $FileMenu) $HelpMenu = GuiCtrlCreateMenu ("Help") $AboutItem = GuiCtrlCreateMenuitem ("About", $HelpMenu) ;TAB GuiCtrlCreateTab(0, 0, $WinWidth, $WinHeight) $findini = "findstuff.ini" $tabsectionread = IniReadSection ($findini,"Tabs") Dim $tabnames[UBound($tabsectionread)-1] For $k = 1 To (UBound($tabnames)) Dim $tempn = IniReadSection($findini,$tabsectionread[$k][1]) For $i = 1 To $tempn[0][0] If $i = 1 Then $tabnames[$k-1] = IniRead($findini, $tabsectionread[$k][1], "TabName", "NoTabNameError") GuiCtrlCreateTabItem($tabnames[$k-1]) Dim $listView = GuiCtrlCreateListView("Name|Detection|Type|Key", 0, 20, $WinWidth, $WinHeight - 40, $LVS_NOSORTHEADER, $LVS_EX_FULLROWSELECT ) Else $SplitStringy = StringSplit($tempn[$i][1],",") ;Registry Check If $SplitStringy[1] = "rc" Or $SplitStringy[1] = "RC" Then If $SplitStringy[4] = RegRead($SplitStringy[3],$SplitStringy[2]) Then GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Installed" & "|" & "Registry Check" & "|" & $SplitStringy[2], $listView) Else GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Not Installed" & "|" & "Registry Check" & "|" & $SplitStringy[2], $listView) EndIf EndIf ;File Version Check If $SplitStringy[1] = "fvc" Or $SplitStringy[1] = "FVC" Then If $SplitStringy[4] = FileGetVersion ($SplitStringy[3] & "\" & $SplitStringy[2]) Then GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Installed" & "|" & "File Version Check" & $SplitStringy[2], $listView) Else GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Not Installed" & "|" & "File Version Check" & "|" & $SplitStringy[2], $listView) EndIf EndIf ;File Date Check If $SplitStringy[1] = "fdc" Or $SplitStringy[1] = "FDC" Then If $SplitStringy[4] = FileGetTime ($SplitStringy[3] & "\" & $SplitStringy[2], 1, 1) Then GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Installed" & "|" & "File Date Check" & "|" & $SplitStringy[2], $listView) Else GUICtrlCreateListViewItem ($tempn[$i][0] & "|" & "Not Installed" & "|" & "File Date Check" & "|" & $SplitStringy[2], $listView) EndIf EndIf EndIf Next Next ; ---------------------------------------------------------------------------- ; Set the operations for program events ; ---------------------------------------------------------------------------- GuiSetState() While 1 $Event = GuiGetMsg() Select Case $Event = -3 Or $Event = -1 or $Event = $ExitItem ExitLoop Case $Event = $AboutItem $iniversion = IniRead($findini, "Version", "DATFiles", "INIKeyNotFound") MsgBox(0, "Welcome to FindStuff!", "Welcome to FindStuff!" & @CRLF & @CRLF & @CRLF & "Find stuff is an INI-based detector program intended to display the currently installed software on a machine." & @CRLF & "Currently installed DAT Files Version " & $iniversion) EndSelect WEnd GUIDelete() ; ---------------------------------------------------------------------------- ; Exit the Program ; ---------------------------------------------------------------------------- Exit INI File it reads from... [Version] Version=1.0 DATFiles=.11 [MainCheck] TabName=Windows Information Service Pack 4=rc,CSDVersion,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion,Service Pack 4 [MSPatchesCheck] TabName=MS Patches Windows 2000 Hotfix - KB328237=rc,Description,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB328237,Windows 2000 Hotfix - KB328237 Windows 2000 Hotfix - KB823182=rc,Description,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823182,Windows 2000 Hotfix - KB823182 Windows 2000 Hotfix - KB823353=rc,Description,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823353,Windows 2000 Hotfix - KB823353 Windows 2000 Hotfix - KB823559=rc,Description,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823559,Windows 2000 Hotfix - KB823559 Windows 2000 Hotfix - KB823559=rc,Description,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB824105,Windows 2000 Hotfix - KB823559 [Tabs] Tab1=MainCheck Tab2=MSPatchesCheck Any help is appreciated... Link to comment Share on other sites More sharing options...
buzz44 Posted June 7, 2005 Share Posted June 7, 2005 The latest BETA's have a range of _GUICtrlListViewXXXXXX() functions, 43 in total I think. Using these functions all your list view dreams will come true , including setting/hiding a column.DL Beta here... qq Link to comment Share on other sites More sharing options...
jeansaad Posted June 7, 2005 Author Share Posted June 7, 2005 Thanks very much i think this will do the trick... However I have to find a way to make it relatively resize every column of the listview... Shouldn't be too hard... But thanks again... Link to comment Share on other sites More sharing options...
blindwig Posted June 8, 2005 Share Posted June 8, 2005 Thanks very much i think this will do the trick... However I have to find a way to make it relatively resize every column of the listview... Shouldn't be too hard... But thanks again...<{POST_SNAPBACK}>Just an idea:Normally, pressing Control and Keypad Plus while the focus is on a ListView will auto-size te columns. Maybe you could try to send that key combination to the control. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
GaryFrost Posted June 9, 2005 Share Posted June 9, 2005 if using the beta use the function _GUICtrlListViewSetColumnWidth and for column size pass $LVSCW_AUTOSIZE, that should do it. 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 More sharing options...
snaileater Posted October 23, 2006 Share Posted October 23, 2006 I want to adjust column width in a ListView, i try the following code : $listview = GUICtrlCreateListView("Agent|Adresse IP", 5, 5, 190, 190, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListViewSetColumnWidth ($listview, 0, $LVSCW_AUTOSIZE) but nothing changes in the column ... Am i forgetting anything ? Thanks for ur help ! Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2006 Share Posted October 23, 2006 I want to adjust column width in a ListView, i try the following code : $listview = GUICtrlCreateListView("Agent|Adresse IP", 5, 5, 190, 190, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListViewSetColumnWidth ($listview, 0, $LVSCW_AUTOSIZE) but nothing changes in the column ... Am i forgetting anything ? Thanks for ur help ! What are you expecting? Auto size may not need to change to the width. If you want a different witdh, put a number in there instead. 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 More sharing options...
snaileater Posted October 23, 2006 Share Posted October 23, 2006 What are you expecting?Auto size may not need to change to the width.If you want a different witdh, put a number in there instead.sorry i'm a bit lost ... doesn't this $LVSCW_AUTOSIZE parameter mean that the column width fits the content of the "largest" item of this column ?with the code i used some parts of my items remain hidden ... which is for me unexpected ... Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2006 Share Posted October 23, 2006 sorry i'm a bit lost ... doesn't this $LVSCW_AUTOSIZE parameter mean that the column width fits the content of the "largest" item of this column ?with the code i used some parts of my items remain hidden ... which is for me unexpected ...try applying that after adding data. 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 More sharing options...
snaileater Posted October 23, 2006 Share Posted October 23, 2006 try applying that after adding data. that's what i did (i think) : 1] i create the lisview with : $listview = GUICtrlCreateListView("Agent|Adresse IP", 5, 5, 190, 190, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) 2] i populate it with a loop containing an : GUICtrlCreateListViewItem($c[1]&"|"&$c[2], $listview) 3] then i set the "auto-size" property ... : _GUICtrlListViewSetColumnWidth ($listview, 1, $LVSCW_AUTOSIZE) but i doesn't work as expected ... Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2006 Share Posted October 23, 2006 http://msdn.microsoft.com/library/en-us/sh...columnwidth.asp 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now