Jump to content

Search the Community

Showing results for tags '_GUICtrlListView_SetColumnWid'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Greetings, I've been struggling with this single problem for 5 or 6 hours now, and I need help. I'm attempting to create a GUI that will remember the widths of columns in its ListView. Values are saved to file on exit, and read when the program runs. It's reading the values in correctly. The problem is when I use _GUICtrlListView_SetColumnWidth to set the column width, the columns are drastically larger than the settings file indicated. I have no idea what's causing this. Any help will be appreciated. If it matters, I am running the most recent AutoIt and SciTE. I have Win7 64-bit, and I've tried both x86 and x64 modes (no dice). Ultimately, I want the user to be able to drag columns wider or narrower (or to hide them) and have it keep those settings. I've commented out the code that sets the column width (see the Initialize() function). Can anyone tell me what I'm doing wrong? Here's the .au3 file: #include #include #include #include Global $hGUI, $hListView Global Const $iniPath = @ScriptDir & '\test.ini' Global Const $ver = "test" Initialize() Main() Func Initialize() ; Create the GUI $hGUI = GUICreate($ver, 400, 440) $hListView = GUICtrlCreateListView("String|URL 1|URL 2|date|number 1|number 2", 5, 5, 390, 390, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) ; Parse the ini file Local $i, $iniFile, $record, $settings If FileExists($iniPath) Then $iniFile = FileOpen($iniPath, 0) $record = FileReadLine($iniFile) If $record <> $ver Then MsgBox(16, "Fatal Error", "test.ini is invalid. Repair or delete to continue." & @LF & "Expected line 1: " & $ver & @LF & "Actual line 1: " & $record) Exit 1 EndIf $settings = StringSplit(FileReadLine($iniFile), '|', 3) $record = FileReadLine($iniFile) While $record <> "" If StringInStr($record, '|', 1, 5) == 0 Or StringInStr($record, '|', 1, 6) > 0 Then MsgBox(16, "Fatal Error", "test.ini is invalid. Repair or delete to continue." & @LF & "Expected: 5 instances of | per line" & @LF & "Error on line " & String(_GUICtrlListView_GetItemCount($hListView) + 1) & ':' & @LF & $record) Exit 1 EndIf GUICtrlCreateListViewItem($record, $hListView) $record = FileReadLine($iniFile) WEnd FileClose($iniFile) ; GUI Settings ;~ _GUICtrlListView_SetColumnWidth($hListView, 0, $settings[0]) ;~ _GUICtrlListView_SetColumnWidth($hListView, 1, $settings[1]) ;~ _GUICtrlListView_SetColumnWidth($hListView, 2, $settings[2]) ;~ _GUICtrlListView_SetColumnWidth($hListView, 3, $settings[3]) ;~ _GUICtrlListView_SetColumnWidth($hListView, 4, $settings[4]) ;~ _GUICtrlListView_SetColumnWidth($hListView, 5, $settings[5]) EndIf GUISetState(@SW_SHOW, $hGUI) EndFunc Func Main() ; Run the GUI While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE SaveAndExit() EndSwitch WEnd EndFunc Func SaveAndExit() ; Save ini file and exit Local $i, $iniFile, $settings $settings = _GUICtrlListView_GetColumnWidth($hListView, 0) & '|' & _ _GUICtrlListView_GetColumnWidth($hListView, 1) & '|' & _ _GUICtrlListView_GetColumnWidth($hListView, 2) & '|' & _ _GUICtrlListView_GetColumnWidth($hListView, 3) & '|' & _ _GUICtrlListView_GetColumnWidth($hListView, 4) & '|' & _ _GUICtrlListView_GetColumnWidth($hListView, 5) $iniFile = FileOpen($iniPath, 2) FileWriteLine($iniFile, $ver) FileWriteLine($iniFile, $settings) For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1 FileWriteLine($iniFile, _GUICtrlListView_GetItemTextString($hListView, $i)) Next FileClose($iniFile) Exit EndFunc Here's a sample settings file (test.ini): test 56|150|150|64|76|76 AutoIt Script|http://www.autoitscript.com/site/autoit/|http://www.autoitscript.com/site/autoit/downloads/|4/10/2012|0|0 As an aside, I've also been playing with switching the order of rows. Currently, my only method of doing this is to read the values individually for each row and column and update them manually. Is there are better way to do that? It would be awesome if there was a way to change an index number and have the order automatically update. I'm not talking about automatically sorting rows. It's more like manually sorting rows.
×
×
  • Create New...