nullschritt Posted June 30, 2013 Posted June 30, 2013 Hello, I am making a listview in my application, to act as a list, the code I am using to create the listview is such: Global $convolist = GUICtrlCreatelistview("0|0|1|1|2|2|3|3|4|4|5|5|6|6|7|7|8|8|9|9",230,60,633,75,16396,524801) Each column name is hidden, and each column will have first a set of data, and then an [x] in the next over like Document1|[x]|Document2|[x], I am sure it will not be hard for me to detect when and which X is clicked, but I am having another problem. It seems that there is no property to resize the listview as text items are added, and I could not find a function to resize a specific cell in the listview, is there a way that I can resize the cells to the width of the text that they are going to contain? Thanks for your time looking at my help request!
BrewManNH Posted June 30, 2013 Posted June 30, 2013 #include <GuiListView.au3> _GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth) If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! Reveal hidden contents I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
nullschritt Posted June 30, 2013 Author Posted June 30, 2013 On 6/30/2013 at 3:19 AM, BrewManNH said: #include <GuiListView.au3> _GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth) Thanks but how can I get the width of the text I am going to be setting?
Solution AZJIO Posted June 30, 2013 Solution Posted June 30, 2013 #include <ListViewConstants.au3> Local $hGUI, $ListView $hGUI = GUICreate("ListView", 540, 360, 100, 200) GUISetBkColor(0xd5d2af) $ListView = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 10, 10, 520, 340) ; GUICtrlSetBkColor(-1, 0xFFFEEE) For $t = 1 To Random(1, 10, 1) $str = '' For $i = 1 To 4 For $j = 1 To Random(1, 10, 1) $str &= Chr(Random(65, 90, 1)) Next $str &= '|' Next $str = StringTrimRight($str, 1) GUICtrlCreateListViewItem($str, $ListView) Next GUISetState() Sleep(1500) For $i = 0 To 3 GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER Next Do Until GUIGetMsg() = -3 My other projects or all
Gianni Posted June 30, 2013 Posted June 30, 2013 On 6/30/2013 at 6:04 AM, AZJIO said: .... For $i = 0 To 3 GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER Next .... beautiful, ...power of messages.... excuse me AZJIO where can be found a "list" of messages accepted by various controls and allowed parameters? thanks Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
KaFu Posted June 30, 2013 Posted June 30, 2013 Those are documented on MSDN. To get the const values I always do a Google search for something like "Const LVM_SETCOLUMNWIDTH". But most messages are already in-cooperated into the existing UDFs anyhow, check _GUICtrlListView_SetColumnWidth(). OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Gianni Posted June 30, 2013 Posted June 30, 2013 (edited) ok, thanks Kafu .... sometimes the "limit" of the internet is its vastness ..... Edited June 30, 2013 by Pincopanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
MyEarth Posted June 30, 2013 Posted June 30, 2013 I can make a question on the same subject? expandcollapse popup#include <GUIConstantsEx.Au3> #include <GuiListView.au3> #include <GUIEdit.Au3> $hGUI = GUICreate("Form", 539, 347, -1, -1) $hListView = GUICtrlCreateListView("Column", 150, 25, 175, 250) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, -2) GUISetState(@SW_SHOW) Sleep(1000) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How to have scrollable listview with the vertical scrolling but "hide" the unaestethic orizzontal scrollbar?
Gianni Posted June 30, 2013 Posted June 30, 2013 (edited) ... well just add this 2 lines .... ..... GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) ; add this 2 lines GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER While 1 ..... ( thanks to AZJIO >#4) Edited June 30, 2013 by Pincopanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
MyEarth Posted June 30, 2013 Posted June 30, 2013 So i need to redo the GUICtrlSendMsg everytime i'll add an item
guinness Posted June 30, 2013 Posted June 30, 2013 What's wrong with just using _GUICtrlListView_SetColumnWidth? Then you don't have to mess around with all that message sending stuff (if you're a novice.) UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Gianni Posted June 30, 2013 Posted June 30, 2013 I'm sorry guinnessI modified MyEarth's listing (line 16) following your advice, expandcollapse popup#include <GUIConstantsEx.Au3> #include <GuiListView.au3> #include <GUIEdit.Au3> $hGUI = GUICreate("Form", 539, 347, -1, -1) $hListView = GUICtrlCreateListView("Column", 150, 25, 175, 250) _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE) ; <- used thi instead of GUICtrlSendMsg() ; GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, -2) GUISetState(@SW_SHOW) Sleep(1000) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) GUICtrlCreateListViewItem("adsdasadsadsads", $hListView) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd but the listbox is displayed with a strange lookwhere am I wrong? thanks Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
guinness Posted June 30, 2013 Posted June 30, 2013 No need to be sorry. This looks fine to me. #include <GUIConstantsEx.Au3> #include <GUIListView.au3> Example() Func Example() Local $hGUI = GUICreate('') Local $iListView = GUICtrlCreateListView('Column', 5, 5, 390, 390) GUISetState(@SW_SHOW, $hGUI) For $i = 1 To 20 GUICtrlCreateListViewItem('adsdasadsadsads', $iListView) Next _GUICtrlListView_SetColumnWidth($iListView, 0, $LVSCW_AUTOSIZE) ; <- used thi instead of GUICtrlSendMsg() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Gianni Posted June 30, 2013 Posted June 30, 2013 okI need to move _GUICtrlListView_SetColumnWidth after GUICtrlCreateListViewItem, (so the listview takes a better look.) However, if you add a new row with GUICtrlCreateListViewItem with a length greater than the previous ones after the _GUICtrlListView_SetColumnWidth, it must be invoked again to adjust the new ColumnWidth, I was hoping that it did automatically.... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
guinness Posted June 30, 2013 Posted June 30, 2013 No, because it can't predict what item lengths will be posted in the future. It's basically like double-clicking on the column, but without the need for a mouse. UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Gianni Posted June 30, 2013 Posted June 30, 2013 (edited) I do not was claiming a "clairvoyant" listview , perhaps a kind of an internal "OnChange" event managed in the listview's background could do... Edited June 30, 2013 by Pincopanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
guinness Posted June 30, 2013 Posted June 30, 2013 Look at WM_NOTIFY and LVN_INSERTITEM. UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
nullschritt Posted June 30, 2013 Author Posted June 30, 2013 (edited) On 6/30/2013 at 6:04 AM, AZJIO said: #include <ListViewConstants.au3> Local $hGUI, $ListView $hGUI = GUICreate("ListView", 540, 360, 100, 200) GUISetBkColor(0xd5d2af) $ListView = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 10, 10, 520, 340) ; GUICtrlSetBkColor(-1, 0xFFFEEE) For $t = 1 To Random(1, 10, 1) $str = '' For $i = 1 To 4 For $j = 1 To Random(1, 10, 1) $str &= Chr(Random(65, 90, 1)) Next $str &= '|' Next $str = StringTrimRight($str, 1) GUICtrlCreateListViewItem($str, $ListView) Next GUISetState() Sleep(1500) For $i = 0 To 3 GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER Next Do Until GUIGetMsg() = -3 I love you! Thanks. This worked great. Edit: One other question if I may though, when I detect clicking on the listview, I can't seem to recall how to get the current element clicked, Is there a way to get the text and id of the element that is clicked, on every click? Edited June 30, 2013 by nullschritt
guinness Posted June 30, 2013 Posted June 30, 2013 Search for WM_NOTIFY in the help file. Example is already present, but you will have to swap out the UDF listview for the native version. UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
nullschritt Posted June 30, 2013 Author Posted June 30, 2013 On 6/30/2013 at 4:33 PM, guinness said: Search for WM_NOTIFY in the help file. Example is already present, but you will have to swap out the UDF listview for the native version. I'm able to get an output like so: +====================================================== -->Line(0067): $NM_CLICK --> hWndFrom: 0x0008145A -->IDFrom: 21 -->Code: -2 -->Index: -1 -->SubItem: 0 -->NewState: 0 -->OldState: 19329680 -->Changed: 0 -->ActionX: 0 -->ActionY: 0 -->lParam: 7859784 -->KeyFlags: 0 +====================================================== But how do I get the actual text of what's been clicked?
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