Jump to content

_GUICtrlListView_EditLabel easy


Recommended Posts

hello guys!
I have a problem with a script, I can someone show me how to use the script _GUICtrlListView_EditLabel it?
but if it can be as simple a working version, so i can understand.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 354, 188, 437, 213)
$ListView1 = GUICtrlCreateListView("nr|name", 0, 0, 346, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
$ListView1_0 = GUICtrlCreateListViewItem("1|myke", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("2|albert", $ListView1)
$Button1 = GUICtrlCreateButton("Edit select", 8, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Set new text", 96, 160, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

thanks`

Link to comment
Share on other sites

  • Moderators

incepator,

I have posted a script here which shows how to do this. :)

But you might want to check out my GUIListViewEx UDF which allows you to do it rather more simply. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

incepator,

I will take a look - but I seem to remember that you could only edit the first column. :(

But did you look at my GUIListViewEx UDF?  That lets you edit as many columns as you want in both native and UDF ListViews - and you can even choose which columns are open for editing. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

incepator,

Here is your script from above using the UDF to edit the items: ;)

#include <GUIConstantsEx.au3>

; Include the UDF
#include "GUIListViewEx.au3"

$Form1 = GUICreate("Form1", 354, 188, 437, 213)

$ListView1 = GUICtrlCreateListView("nr|name", 0, 0, 346, 150)

_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)

GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)

$Button1 = GUICtrlCreateButton("Edit select", 8, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Set new text", 96, 160, 75, 25)

GUISetState(@SW_SHOW)

; Read the ListView content into an array
$aLV_Content = _GUIListViewEx_ReadToArray($ListView1)
; Initiate UDF - use read content - no count element - black insert mark - no drag image - editable - all cols editable by default
$iLV_Index = _GUIListViewEx_Init($ListView1, $aLV_Content, 0, 0, False, 2)
; Register for editing - no dragging possible
_GUIListViewEx_MsgRegister(True, False, False)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ; Start editing the selected row
            _GUIListViewEx_EditItem($iLV_Index, _GUICtrlListView_GetSelectedIndices($ListView1), 0, 13)
        Case $Button2
    EndSwitch
WEnd

Clearer now? Do ask if not. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks @Melba23

I looked over your GUIListViewEx udf.

I would like to edit only column "name" and the push button2 to set new text

Very ... complex, at least for me...but i understand in greater, I'm still a newbie :graduated:

Edited by incepator
Link to comment
Share on other sites

  • Moderators

incepator,

If you want to edit the column header title then you can do it like this: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 354, 188, 437, 213)

$ListView1 = GUICtrlCreateListView("nr|name", 0, 0, 346, 150)

_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)

GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)

$Button1 = GUICtrlCreateButton("Edit select", 8, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Set new text", 184, 160, 75, 25)

$cInput = GUICtrlCreateInput("", 96, 160, 75, 25)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ; Which header?
            $iCol = _GUICtrlListView_GetSelectedColumn($ListView1)
            $aColInfo = _GUICtrlListView_GetColumn($ListView1, $iCol)
            ; Open the input
            GUICtrlSetData($cInput, $aColInfo[5])
            GUICtrlSetState($cInput, $GUI_ENABLE)
            ; Wait for the set button
            While 1
                Switch GUIGetMsg()
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $Button2
                        ; Read, clear and disable the input
                        $sText = GUICtrlRead($cInput)
                        GUICtrlSetData($cInput, "")
                        GUICtrlSetState($cInput, $GUI_DISABLE)
                        ; And change the header
                        $sText = _GUICtrlListView_SetColumn($ListView1, $iCol, $sText)
                        ExitLoop
                EndSwitch
            WEnd
    EndSwitch
WEnd

Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    ; Our ListView
    If DllStructGetData($tNMHDR, "IDFrom") = $ListView1 Then
        ; Column Clicked?
        If DllStructGetData($tNMHDR, "Code") = $LVN_COLUMNCLICK Then
            ; Set Selected column
            $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
            $iCol = DllStructGetData($tInfo, "SubItem")
            _GUICtrlListView_SetSelectedColumn($ListView1, $iCol)
        EndIf
    EndIf

EndFunc   ;==>_WM_NOTIFY

A bit simpler. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

incepator,
 
I have written a couple of new functions for the UDF to make editing the column headers very easy.  Just click on a column to select it and then press the button: ;)

#include <GUIConstantsEx.au3>

; Include the Beta UDF
#include "GUIListViewEx_Mod.au3"

$Form1 = GUICreate("Form1", 354, 188, 437, 213)

$ListView1 = GUICtrlCreateListView("nr|name", 0, 5, 346, 150)

_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)

GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)

$Button1 = GUICtrlCreateButton("Edit select", 8, 160, 75, 25)

GUISetState(@SW_SHOW)

; Read the ListView content into an array
$aLV_Content = _GUIListViewEx_ReadToArray($ListView1)
; Initiate UDF - use read content - no count element - black insert mark - no drag image - editable inc header - all cols editable by default
$iLV_Index = _GUIListViewEx_Init($ListView1, $aLV_Content, 0, 0, False, 2 + 8)
; Register for editing - no dragging possible
_GUIListViewEx_MsgRegister(True, False, False, True)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
        ; Use the new function to edit the selected column
        _GUIListViewEx_EditHeader($iLV_Index) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch

    _GUIListViewEx_EditOnClick() ; Look for the double click just above the header <<<<<<<<<<<<<<

WEnd

Pressing {ENTER} will change the header text - pressing {ESC} or clicking outside the edit will abandon the process.  :)
 
You will need this Beta version of the UDF to run the script - save it as GUIListViewEx_Mod.au3:see new version below
 
Happy with that? :)
 
M23
 
Edit:
 
Changed for an even newer Beta which will edit the header if you click just above it.  The header does not notify double clicks itself (MS problem, nothing to do with AutoIt) so the UDF creates a small label just above the ListView which does. ;)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Ok @Melba23, I managed to do this, but now i have another problem, how can i display a msgbox with new text entered.

This is my script:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx.au3"
#include <Array.au3>


Global $aLV_List_Left, $aLV_List_Right, $aRet, $iEditMode = 0

$Form1 = GUICreate("Form1", 354, 188, 437, 213)
$ListView1 = GUICtrlCreateListView("nr|name", 0, 5, 346, 150)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)
GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
$Button1 = GUICtrlCreateButton("Save New Text", 8, 160, 90, 25)

$iLV_Left_Index = _GUIListViewEx_Init($ListView1, $aLV_List_Left, 0, 0, True, 1 + 2, "1")
GUISetState(@SW_SHOW)

_GUIListViewEx_MsgRegister()
_GUIListViewEx_SetActive(1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $new_text = ""
            $open = FileOpen("file.txt",1)
            $write_line = FileWriteLine($open,$new_text)
            FileClose($open)
            MsgBox(64, "Info", "New text: "&$new_text&" succes saved !")
    EndSwitch
    $aRet = _GUIListViewEx_EditOnClick($iEditMode) ; Use combos to change EditMode
WEnd
Edited by incepator
Link to comment
Share on other sites

  • Moderators

incepator,
 
Some people are never satisfied! :D
 
This will work:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx_Mod.au3"
#include <Array.au3>

Global $aLV_List_Left, $aRet, $iEditMode = 0, $sNewName

$Form1 = GUICreate("Form1", 354, 188, 437, 213)
$ListView1 = GUICtrlCreateListView("nr|name", 0, 5, 346, 150)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)
GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
$Button1 = GUICtrlCreateButton("Save New Text", 8, 160, 90, 25)

$iLV_Left_Index = _GUIListViewEx_Init($ListView1, $aLV_List_Left, 0, 0, True, 1 + 2 + 8, "1")
GUISetState(@SW_SHOW)

_GUIListViewEx_MsgRegister()
_GUIListViewEx_SetActive(1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $sNewName Then
                ; If something was changed we can now read it
                $open = FileOpen("file.txt", 1)
                $write_line = FileWriteLine($open, $sNewName)
                FileClose($open)
                MsgBox(64, "Info", "New text: " & $sNewName & " succes saved !")
                $sNewName = ""
            EndIf
    EndSwitch
    $aRet = _GUIListViewEx_EditOnClick($iEditMode) ; An array is returned when you edit
    If IsArray($aRet) Then
        $sNewName = $aRet[1] ; Here we save the new value
    EndIf

WEnd

With this Beta version: See new version below
 
Happy now? :)
 
M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

incepator,

Does that happen when you run the example or when you put the function in your own script?  If it is in your own script, do you check that the variable is an array before trying to access it. :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It's happening for me as well, as soon as you click the button "Save New Text" it returns an array, but the array only contains a zero in the first element [0] and nothing else.

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 Gude
How to ask questions the smart way!

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

Link to comment
Share on other sites

  • Moderators

BrewManNH,

I see it now - I was trying to get a single function to do too much.  Give a me a moment to address the problem. :)

While you are here - do you think the "double-click" just above the header to edit is worth having or is it too fiddly?  As I explained, ListView headers do not normally send messages when doubleclicked and I am reluctant to subclass the header just for that. :huh:

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Sorry all,

The problem was caused by by my declaring the return array as [2] in one case (header) and [1][2] in the other (items) - hence the error when it was accessed using 1D notation but was actually a 2D array. :>

This should work - both arrays now match and there is a simple test to determine which sort of edit took place:  See new version below

when used with this slightly modified example:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx_Mod.au3"
#include <Array.au3>

Global $aLV_List_Left, $aRet, $iEditMode = 0, $sNewName

$Form1 = GUICreate("Form1", 354, 188, 437, 213)
$ListView1 = GUICtrlCreateListView("nr|name", 0, 5, 346, 150)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 50)
GUICtrlCreateListViewItem("1|myke", $ListView1)
GUICtrlCreateListViewItem("2|albert", $ListView1)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
$Button1 = GUICtrlCreateButton("Save New Text", 8, 160, 90, 25)

$iLV_Left_Index = _GUIListViewEx_Init($ListView1, $aLV_List_Left, 0, 0, True, 1 + 2 + 8, "1")
GUISetState(@SW_SHOW)

_GUIListViewEx_MsgRegister()
_GUIListViewEx_SetActive(1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $sNewName Then
                ; If something was changed we can now read it
                $open = FileOpen("file.txt", 1)
                $write_line = FileWriteLine($open, $sNewName)
                FileClose($open)
                MsgBox(64, "Info", "New text: " & $sNewName & " succes saved !")
                $sNewName = ""
            EndIf
    EndSwitch
    $aRet = _GUIListViewEx_EditOnClick($iEditMode) ; An array is returned when you edit
    If IsArray($aRet) Then
        ; Check it was a column edit
        If $aRet[0][1] Then ; This element will be blank if itens were edited
            $sNewName = $aRet[0][1] ; Here we save the new column value

            ConsoleWrite("Header edited" & @CRLF) ; Just to prove it!

        Else

            ConsoleWrite("Items edited" & @CRLF) ; Just to prove it!

        EndIf
    EndIf

WEnd
Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I notice that when I click on a LV item, one of the items gets checked and the 2 items swap postion. Makes it hard to figure out which item to double click on, because you're double clicking on the wrong one most of the time.

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 Gude
How to ask questions the smart way!

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

Link to comment
Share on other sites

  • Moderators

BrewManNH,
 

You are being picky today! :P

I am less and less convinced that "header edit" is a good idea, particulrly the "on double click" kind, as it seems to bring in lots of unwanted side-effects. I will see if I can get them sorted, but if not then I will not bother developing it further. :)

M23

Edit:  Found the problem - try this version: See new UDF release

Edited by Melba23
Removed file

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

incepator,

Glad I could help you solve your problem. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...