Jump to content

GUIListViewEx - BugFix Version 6 Apr 24


Melba23
 Share

Recommended Posts

  • Moderators

supersonic,

Thanks for pointing it out, I will take yet another look at the code.

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

  • 1 month later...

@Melba23

I am not sure what I am doing wrong, but I cannot get your UDF to work for the life of me.  I have a script that is able to load a template from an INI file.  The script will then scan two pieces of text loaded from the ini file, look for all of the "%" characters (which are meant to be variables that can be edited from within the program itself), and load the full variable (%NAME%) in the first column of the listview and load a column which can be edited and will allow the user to set the value for the variable on the same row.  If my explanation is confusing, then maybe I can simplify it by saying I want the list view to mimic the functionality of this application.  However, when I create and instantiate the list view and try to set the appropriate column as editable, I get nothing.  Can you please let me know what I am doing wrong?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <ListBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
; *** Start added by AutoIt3Wrapper ***
#include <AutoItConstants.au3>
; *** End added by AutoIt3Wrapper ***
; *** Start added by AutoIt3Wrapper ***
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.15.0 (Beta)
    Author:        William Higgs

    Script Function:
    Provides a graphical user interface for the command line utility "Cmail", which lets one send emails via command line.  I wrote this
    specificially to reduced the ammount of time needed to send messages to potential employers.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <ListViewConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GuiEdit.au3>
#include <GuiListBox.au3>
#include <Constants.au3>
#include "GUIListViewEx.au3"
#include <Word.au3>
#include <Array.au3>
OnAutoItExitRegister("_Exit")
Global $trans = False
;_WordErrorHandlerRegister()
If Not FileExists(@MyDocumentsDir & "\settings.ini") Then
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("Name", "What is the name wou want the recipients of your messages to see in regards to the sender? (Should be your name)", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Name", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("Email address", "What is your email address or the email address of the account sending the mail?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("SMTP server", "What is the address of the SMTP server for your outgoing mail?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Port", "What is the port used by smtp server?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Port", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Username", "What is the username used to login to your email?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "User name", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Password", "What is the password used to login to your email?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Password", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_SYSTEMMODAL, "Proxy server?", "Does your network utilize a proxy server?")
    If $iMsgBoxAnswer = $IDYES Then
        $sInputBoxAnswer = InputBox("Proxy server", "What is the proxy server address?", "", " ")
        If @error = 1 Then
            Exit
        Else
            IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Proxy", $sInputBoxAnswer)
        EndIf
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Proxy", "False")
    EndIf
EndIf
Global $oWordApp = _Word_Create(False)
Global $oDoc = _Word_DocAdd($oWordApp)
Global $oRange = $oDoc.Range
Global $oWordApp2 = _Word_Create(False)
Global $oDoc2 = _Word_DocAdd($oWordApp2)
Global $oRange2 = $oDoc2.Range
Global $oSpellCollection, $oAlternateWords, $oSpellCollection2, $oAlternateWords2
OnAutoItExitRegister("_Exit")
HotKeySet("^d", "stylish")
Global $attach = ""
Global $array
Global $both = False
Global $both2 = False
;$sphand = _Spell_HunspellInit ( "C:\hunspell-en_US\en_US.aff", "C:\hunspell-en_US\en_US.dic" )
$Form2 = GUICreate("Form2", 406, 514, 320, 200, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
$handle = WinGetHandle($Form2)
$MenuItem1 = GUICtrlCreateMenu("configure")
$MenuItem2 = GUICtrlCreateMenuItem("Attachments", $MenuItem1)
$Label1 = GUICtrlCreateLabel("Email Address", 128, 0, 130, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 70, 32, 273, 21)
$Label2 = GUICtrlCreateLabel("Attachments (Can drag and drop below)", 27, 64, 351, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 32, 104, 337, 21, $ES_READONLY)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button9 = GUICtrlCreateButton("Add/Browse", 158, 136, 89, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Label4 = GUICtrlCreateLabel("Subject", 160, 184, 157, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 32, 216, 337, 21)
$Label3 = GUICtrlCreateLabel("Message", 160, 240, 172, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Edit1 = GUICtrlCreateEdit("", 32, 272, 345, 153, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$Button1 = GUICtrlCreateButton("Send", 30, 440, 113, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("Save As Template", 160, 440, 105, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button6 = GUICtrlCreateButton("Use Template", 282, 440, 113, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Form5 = GUICreate("Dynamic Variables", 274, 290, 750, 514)
$ListView1 = GUICtrlCreateListView("Dynamic Variable|Value", 15, 5, 241, 241, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS) )
_GUICtrlListView_SetExtendedListViewStyle($ListView1, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 110)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 127)
$iLVIndex_1 = _GUIListViewEx_Init ( $ListView1 )
_GUIListViewEx_SetEditStatus($iLVIndex_1, 1, 1)

$Form1 = GUICreate("Spell Check", 396, 360, 694, 220)
Global $handle2 = WinGetHandle($Form1)
$Label7 = GUICtrlCreateLabel("Subject", 162, 8, 70, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Listbox3 = GUICtrlCreateList("", 24, 40, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Listbox4 = GUICtrlCreateList("", 232, 40, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Label8 = GUICtrlCreateLabel("Body", 173, 136, 49, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Listbox1 = GUICtrlCreateList("", 24, 168, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Listbox2 = GUICtrlCreateList("", 232, 168, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Label9 = GUICtrlCreateLabel("Errors", 64, 272, 53, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Corrections", 256, 272, 96, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Send", 32, 313, 75, 25, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button5 = GUICtrlCreateButton("Correct Spelling", 152, 313, 83, 25, $BS_NOTIFY)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetCursor(-1, 0)
$Button4 = GUICtrlCreateButton("Cancel", 280, 313, 75, 25, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Form3 = GUICreate("Form3", 286, 283, 192, 124)
$Label5 = GUICtrlCreateLabel("Attachments", 86, 8, 113, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$List1 = GUICtrlCreateList("", 16, 40, 249, 188, $LBS_NOTIFY + $WS_VSCROLL)
$Button7 = GUICtrlCreateButton("Delete", 40, 240, 81, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button8 = GUICtrlCreateButton("Back", 160, 240, 81, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Form4 = GUICreate("Form4", 242, 95, 216, 123)
$Combo1 = GUICtrlCreateCombo("", 40, 56, 169, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$Label6 = GUICtrlCreateLabel("Templates", 72, 8, 96, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
_GUIListViewEx_MsgRegister()
GUISetState(@SW_DISABLE, $Form4)
GUISetState(@SW_DISABLE, $Form3)
GUISetState(@SW_DISABLE, $Form1)
GUISetState(@SW_SHOW, $Form2)
$aRect = _GUICtrlEdit_GetRECT($Edit1)
$aRect[0] += 10
$aRect[1] += 10
$aRect[2] -= 10
$aRect[3] -= 10
_GUICtrlEdit_SetRECT($Edit1, $aRect)

While 1
    Global $nMsg = GUIGetMsg(1)
    Switch $nMsg[1]
        Case $Form2
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    _Exit()
                Case $GUI_EVENT_DROPPED
                    Sleep(200)
                    $mult = StringSplit(GUICtrlRead($Input2), "|")
                    If @error Then
                        WinActivate($Form2)
                        WinWaitActive($Form2)
                        GUICtrlSetState($Input2, $GUI_FOCUS)
                        Send("{ENTER}", 0)
                    Else
                        For $v = 1 To $mult[0] Step 1
                            $attach = $attach & $mult[$v] & ";"
                        Next
                        GUICtrlSetData($Input2, "")
                        $sToolTipAnswer = ToolTip("The attachments were added!", Default, Default, "Success")
                        Sleep(3000)
                        ToolTip("")
                    EndIf

                Case $MenuItem2
                    GUISetState(@SW_HIDE, $Form2)
                    GUISetState(@SW_DISABLE, $Form2)
                    GUISwitch($Form3)
                    GUISetState(@SW_ENABLE, $Form3)
                    GUISetState(@SW_SHOW, $Form3)
                    If $attach <> "" Then
                        $array = StringSplit(StringTrimRight($attach, 1), ";")
                        If @error Then
                            SetError(0)
                            _GUICtrlListBox_AddString($List1, _GetFilename(StringTrimRight($attach, 1)) & "." & _GetFilenameExt(StringTrimRight($attach, 1)))
                        Else
                            For $l = 1 To $array[0] Step 1
                                _GUICtrlListBox_AddString($List1, _GetFilename($array[$l]) & "." & _GetFilenameExt($array[$l]))
                            Next
                        EndIf
                    Else
                        _GUICtrlListBox_AddString($List1, "You currently do not have any attachments.")
                    EndIf
                Case $Input2
                    $attach = $attach & GUICtrlRead($Input2) & ";"
                    GUICtrlSetData($Input2, "")
                    $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                    Sleep(3000)
                    ToolTip("")

                Case $Button9
                    If GUICtrlRead($Input2) <> "" Then
                        If FileExists(GUICtrlRead($Input2)) Then
                            $attach = $attach & GUICtrlRead($Input2) & ";"
                            GUICtrlSetData($Input2, "")
                            $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                            Sleep(3000)
                            ToolTip("")
                        Else
                            If Not IsDeclared("sToolTipAnswer") Then Local $sToolTipAnswer
                            $sToolTipAnswer = ToolTip("File name entered does not exist", Default, Default, "Failure", 0, 0)
                            Sleep(3000)
                            ToolTip("")
                        EndIf

                    Else
                        $file = FileOpenDialog("Choose the file you want to attach.", "", "All (*.*)", 7, "", $Form2)
                        If $file = "" Then

                        Else
                            $files = StringSplit($file, "|")
                            If @error Then
                                SetError(0)
                                $attach = $attach & $file & ";"
                                GUICtrlSetData($Input2, $file)
                                $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                                Sleep(1000)
                                ToolTip("")
                                GUICtrlSetData($Input2, "")
                            Else
                                For $p = 2 To $files[0] Step 1
                                    $attach = $attach & $files[1] & "\" & $files[$p] & ";"
                                Next
                                $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                                Sleep(1000)
                                ToolTip("")
                            EndIf
                        EndIf

                    EndIf
                Case $Button1
                    If StringRight(GUICtrlRead($Input3), 1) <> "." Or StringRight(GUICtrlRead($Input3), 1) <> "!" Or StringRight(GUICtrlRead($Input3), 1) <> "?" Or StringRight(GUICtrlRead($Input3), 1) <> " " Then
                        GUICtrlSetData($Input3, GUICtrlRead($Input3) & " ")
                    EndIf
                    ;_GUICtrlEdit_SetSel ( $Edit1, 0, -1 )
                    _SpellCheck()
                Case $Button2 ;save as template
                    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
                    $sInputBoxAnswer = InputBox("Template Name", "What do you want to name this template?", "", " ")
                    If @error = 1 Then

                    Else
                        $name = $sInputBoxAnswer
                        $num = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                        $num += 1
                        $bodcap = _GUICtrlEdit_GetText($Edit1)
                        $bodcap = StringReplace($bodcap, @CRLF, "\n")
                        $subcap = GUICtrlRead($Input3)
                        $attcap = $attach
                        Local $holdarr[5][2] = [[3, ""], ["Name", $name], ["Body", $bodcap], ["Subject", $subcap], ["Attachments", $attcap]]
                        IniWriteSection(@MyDocumentsDir & "\settings.ini", "Template " & $num, $holdarr)
                        IniWrite(@MyDocumentsDir & "\settings.ini", "Number", "Template", $num)
                        $sToolTipAnswer = ToolTip("The template was saved!", Default, Default, "Success")
                        Sleep(2000)
                        ToolTip("")
                    EndIf

                Case $Button6
                    GUISetState(@SW_HIDE, $Form2)
                    GUISetState(@SW_DISABLE, $Form2)
                    GUISwitch($Form3)
                    GUISetState(@SW_ENABLE, $Form4)
                    GUISetState(@SW_SHOW, $Form4)
                    $numag = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                    If $numag = 0 Then
                        MsgBox($MB_OK + $MB_ICONHAND, "No templates", "You have not configured any templates.")
                    Else
                        For $h = 1 To $numag Step 1
                            GUICtrlSetData($Combo1, IniRead(@MyDocumentsDir & "\settings.ini", "Template " & $h, "Name", "NA"))
                        Next
                    EndIf

            EndSwitch
        Case $Form1
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Form1)
                    GUISetState(@SW_DISABLE, $Form1)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                Case $Listbox1
                    ;_SpellCheck2 ()
                    _SpellingSuggestions()
                Case $Listbox2
                    GUICtrlSetState($Button5, $GUI_ENABLE)
                Case $Listbox3
                    ;_SpellCheck ()
                    _SpellingSuggestions2()
                Case $Listbox4
                    GUICtrlSetState($Button5, $GUI_ENABLE)
                Case $Button3
                    SendMessage()
                Case $Button4
                    GUISetState(@SW_HIDE, $Form1)
                    GUISetState(@SW_DISABLE, $Form1)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                Case $Button5
                    If _GUICtrlListBox_GetSelCount($Listbox4) > 0 Then
                        _ReplaceWord2()
                    EndIf
                    If _GUICtrlListBox_GetSelCount($Listbox2) > 0 Then
                        _ReplaceWord()
                    EndIf
                    _SpellCheck()
            EndSwitch
        Case $Form3
            ToolTip("")
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE, $Button8
                    ToolTip("")
                    GUISetState(@SW_HIDE, $Form3)
                    GUISetState(@SW_DISABLE, $Form3)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                    If UBound($array) = 1 Then
                        $attach = ""
                    Else
                        $attach = ""
                        For $ff = 1 To UBound($array) - 1 Step 1
                            $attach = $attach & $array[$ff] & ";"
                        Next
                    EndIf
                    _GUICtrlListBox_ResetContent($List1)
                Case $List1
                    ToolTip("")
                Case $Button7
                    If _GUICtrlListBox_GetSelCount = -1 Then
                        $sToolTipAnswer = ToolTip("Select something to delete first numbnuts.", Default, Default, "Idiot")
                    Else
                        ToolTip("")
                        $seltext = _GUICtrlListBox_GetText($List1, _GUICtrlListBox_GetCurSel($List1))
                        For $ff = 1 To $array[0] Step 1
                            If StringInStr($array[$ff], $seltext) > 0 Then
                                _ArrayDelete($array, $ff)
                                _GUICtrlListBox_DeleteString($List1, _GUICtrlListBox_GetCurSel($List1))
                                ExitLoop
                            EndIf
                        Next
                    EndIf
            EndSwitch
        Case $Form4
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Form4)
                    GUISetState(@SW_DISABLE, $Form4)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                Case $Combo1
                    $sec = ""
                    $numag2 = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                    If $numag2 = 0 Then

                    Else
                        $use = GUICtrlRead($Combo1)
                        For $h = 1 To $numag2 Step 1
                            If StringCompare(IniRead(@MyDocumentsDir & "\settings.ini", "Template " & $h, "Name", "NA"), $use) = 0 Then
                                $sec = "Template " & $h
                                ExitLoop
                            Else
                                ContinueLoop
                            EndIf
                        Next
                        GUISetState(@SW_HIDE, $Form4)
                        GUISetState(@SW_DISABLE, $Form4)
                        GUISwitch($Form2)
                        GUISetState(@SW_ENABLE, $Form2)
                        GUISetState(@SW_SHOW, $Form2)
                        $attach = IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Attachments", "NA")
                        GUICtrlSetData($Input3, IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"))
                        $thetext = IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Body", "NA")
                        _GUICtrlEdit_SetText($Edit1, StringReplace($thetext, "\n", @CRLF))
                        $subcheck = True
                        $bodcheck = True
                        $loc1 = ""
                        $loc2 = ""
                        $hol = 1
                        While 1
                            $varcheck = StringInStr ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), "%", Default, $hol )
                            If $varcheck = 0 Or @error Then
                                SetError ( 0 )
                                ExitLoop
                            Else
                                $hol += 1
                                If StringMid ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), Int ( $varcheck ) - 1, 1 ) <> "\" Then
                                    $loc1 = $loc1 & $varcheck & ";"
                                Else
                                    ContinueLoop
                                EndIf
                            EndIf
                        WEnd
                        If $loc1 <> "" Then
                            $subcheck = True
                            $holsplit = StringSplit ( StringTrimRight ( $loc1, 1 ), ";", $STR_NOCOUNT )
                            $values = ""
                            For $i = 0 To UBound ( $holsplit ) - 1 Step 2
                                $values = $values & StringMid ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), Int ( $holsplit[$i] ), ( Int ( $holsplit[$i+1] ) - Int ( $holsplit[$i] ) ) + 1 ) & ";"
                            Next
                        Else
                            $subcheck = False
                        EndIf


                        $hol = 1
                        While 1
                            $varcheck2 = StringInStr ( StringReplace($thetext, "\n", @CRLF), "%", Default, $hol )
                            If $varcheck2 = 0 Or @error Then
                                SetError ( 0 )
                                ExitLoop
                            Else
                                $hol += 1
                                If StringMid ( StringReplace($thetext, "\n", @CRLF), Int ( $varcheck2 ) - 1, 1 ) <> "\" Then
                                    $loc2 = $loc2 & $varcheck2 & ";"
                                Else
                                    ContinueLoop
                                EndIf
                            EndIf
                        WEnd
                        If $loc2 <> "" Then
                            $bodcheck = True
                            $holsplit = StringSplit ( StringTrimRight ( $loc2, 1 ), ";", $STR_NOCOUNT )
                            $values2 = ""
                            For $i = 0 To UBound ( $holsplit ) - 1 Step 2
                                $values2 = $values2 & StringMid ( StringReplace($thetext, "\n", @CRLF), Int ( $holsplit[$i] ), ( Int ( $holsplit[$i+1] ) - Int ( $holsplit[$i] ) ) + 1 ) & ";"
                            Next
                        Else
                            $bodcheck = False
                        EndIf



                        If $subcheck Or $bodcheck Then
                            GUISetState ( @SW_SHOW, $Form5 )
                            _GUIListViewEx_SetActive ( $iLVIndex_1 )
                            If $subcheck Then
                                $holsplit = StringSplit ( StringTrimRight ( $values, 1 ), ";", $STR_NOCOUNT )
                                For $i = 0 To UBound ( $holsplit ) - 1 Step 1
                                    Global $arrr[2] = [$holsplit[$i], StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 )]
                                    _GUIListViewEx_Insert ( $arrr )
                                    ;GUICtrlCreateListViewItem ( $holsplit[$i] & "|" & StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $ListView1 )
                                Next
                            EndIf
                            If $bodcheck Then
                                $holsplit = StringSplit ( StringTrimRight ( $values2, 1 ), ";", $STR_NOCOUNT )
                                For $i = 0 To UBound ( $holsplit ) - 1 Step 1
                                    Global $arrr[2] = [$holsplit[$i], StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 )]
                                    _GUIListViewEx_Insert ( $arrr )
                                    ;GUICtrlCreateListViewItem ( $holsplit[$i] & "|" & StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $ListView1 )
                                Next
                            EndIf
                            $ind = _GUIListViewEx_ReadToArray ( $ListView1 )
                            $iLVIndex_1 = _GUIListViewEx_Init ( $ListView1, $ind )
                        _GUIListViewEx_SetEditStatus($iLVIndex_1, 1, 1)
                        ;GUISwitch ( $Form5 )
                        EndIf
                    EndIf
            EndSwitch
        Case $Form5
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState ( @SW_HIDE, $Form5 )
            EndSwitch

    EndSwitch
WEnd
Func stylish()
    $thestyle = GUIGetStyle($handle)
    If $trans = False Then
        GUISetStyle(-1, $thestyle[1] + 32, $handle)
        WinSetTrans($handle, "", 170)
        $trans = True
    Else
        GUISetStyle(-1, $thestyle[1] - 32, $handle)
        WinSetTrans($handle, "", 255)
        $trans = False
    EndIf
EndFunc   ;==>stylish
Func GetHoveredHwnd()
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If IsArray($iRet) Then Return HWnd($iRet[0])
    Return SetError(1, 0, 0)
EndFunc   ;==>GetHoveredHwnd
Func _SpellCheck()
    Local $sText, $sText2, $sWord, $sWord2

    $both = False
    $pText = _GUICtrlEdit_GetText($Edit1)
    $oRange.Delete
    $oRange.InsertAfter($pText)
    _SetLanguage()
    $both2 = False
    $pText2 = GUICtrlRead($Input3)
    $oRange2.Delete
    $oRange2.InsertAfter($pText2)
    _SetLanguage2()

    $oSpellCollection = $oRange.SpellingErrors
    $oSpellCollection2 = $oRange2.SpellingErrors
    ;Local $argg[$oSpellCollection.Count]
    _GUICtrlListBox_ResetContent($Listbox1)
    _GUICtrlListBox_ResetContent($Listbox2)
    _GUICtrlListBox_ResetContent($Listbox3)
    _GUICtrlListBox_ResetContent($Listbox4)
    GUICtrlSetState($Button5, $GUI_DISABLE)
    If $oSpellCollection.Count > 0 Or $oSpellCollection2.Count > 0 Then
        If BitAND(WinGetState($handle), 2) Then
            If $trans = True Then
                stylish()
            EndIf
            GUISetState(@SW_DISABLE, $Form2)
            GUISetState(@SW_HIDE, $Form2)
            GUISwitch($Form1)
            GUISetState(@SW_SHOW, $Form1)
            GUISetState(@SW_ENABLE, $Form1)
        EndIf

        If $oSpellCollection.Count > 0 Then

            For $i = 1 To $oSpellCollection.Count
                _GUICtrlListBox_AddString($Listbox1, $oSpellCollection.Item($i).Text)
            Next
            ;_GUICtrlEdit_SetText($Edit1, $oRange.Text)
            ;GUICtrlSetData($Input3, $oRange2.Text)
        Else
            _GUICtrlListBox_AddString($Listbox1, "No spelling errors")
        EndIf
        If $oSpellCollection2.Count > 0 Then
            _GUICtrlListBox_ResetContent($Listbox3)
            _GUICtrlListBox_ResetContent($Listbox4)
            GUICtrlSetState($Button5, $GUI_DISABLE)
            For $p = 1 To $oSpellCollection2.Count
                _GUICtrlListBox_AddString($Listbox3, $oSpellCollection2.Item($p).Text)
            Next
            ;_GUICtrlEdit_SetText ($Edit1, $oRange.Text)
            ;GUICtrlSetData($Input3, $oRange2.Text)
        Else
            _GUICtrlListBox_AddString($Listbox3, "No spelling errors")
        EndIf

    Else
        _GUICtrlEdit_SetText ($Edit1, $oRange.Text)
        GUICtrlSetData($Input3, $oRange2.Text)
        SendMessage()
    EndIf

EndFunc   ;==>_SpellCheck


Func _SpellingSuggestions()
    Local $iWord, $ssWord
    ;
    _GUICtrlListBox_ResetContent($Listbox2)
    If _GUICtrlListBox_GetSelCount($Listbox4) = 0 Then
        GUICtrlSetState($Button5, $GUI_DISABLE)
    EndIf



    $iWord = _GUICtrlListBox_GetCurSel($Listbox1) + 1
    $ssWord = $oSpellCollection.Item($iWord).Text
    $oAlternateWords = $oWordApp.GetSpellingSuggestions($ssWord)



    If $oAlternateWords.Count > 0 Then
        For $v = 1 To $oAlternateWords.Count
            _GUICtrlListBox_AddString($Listbox2, $oAlternateWords.Item($v).Name)
        Next
    Else
        _GUICtrlListBox_AddString($Listbox2, "No suggestions.")
    EndIf
EndFunc   ;==>_SpellingSuggestions

Func _SpellingSuggestions2()
    Local $iWord2, $ssWord2
    ;
    _GUICtrlListBox_ResetContent($Listbox4)
    If _GUICtrlListBox_GetSelCount($Listbox2) = 0 Then
        GUICtrlSetState($Button5, $GUI_DISABLE)
    EndIf


    $iWord2 = _GUICtrlListBox_GetCurSel($Listbox3) + 1
    $ssWord2 = $oSpellCollection2.Item($iWord2).Text
    $oAlternateWords2 = $oWordApp2.GetSpellingSuggestions($ssWord2)



    If $oAlternateWords2.Count > 0 Then
        For $c = 1 To $oAlternateWords2.Count
            _GUICtrlListBox_AddString($Listbox4, $oAlternateWords2.Item($c).Name)
        Next
    Else
        _GUICtrlListBox_AddString($Listbox4, "No suggestions.")
    EndIf
EndFunc   ;==>_SpellingSuggestions2

Func _ReplaceWord()
    Local $iWord, $iNewWord, $sWord, $sNewWord, $sText, $sNewText
    ;
    $iWord = _GUICtrlListBox_GetCurSel($Listbox1) + 1
    $iNewWord = _GUICtrlListBox_GetCurSel($Listbox2) + 1
    If $iWord == $LB_ERR Or $iNewWord == $LB_ERR Then
        ;MsgBox(48, "Error", "You must first select a word to replace, then a replacement word.")
        ;Return
    Else
        $oSpellCollection.Item($iWord).Text = $oAlternateWords.Item($iNewWord).Name
        _GUICtrlEdit_SetText($Edit1, $oRange.Text)
    EndIf


EndFunc   ;==>_ReplaceWord
Func _ReplaceWord2()
    Local $iWord2, $iNewWord2, $sWord2, $sNewWord2, $sText2, $sNewText2
    ;
    $iWord2 = _GUICtrlListBox_GetCurSel($Listbox3) + 1
    $iNewWord2 = _GUICtrlListBox_GetCurSel($Listbox4) + 1
    If $iWord2 == $LB_ERR Or $iNewWord2 == $LB_ERR Then
        ;MsgBox(48, "Error", "You must first select a word to replace, then a replacement word.")
        ;Return
    Else
        $oSpellCollection2.Item($iWord2).Text = $oAlternateWords2.Item($iNewWord2).Name
        GUICtrlSetData($Input3, $oRange2.Text)
    EndIf


EndFunc   ;==>_ReplaceWord2

Func _SetLanguage()
    $sLang = "English"
    $oWordApp.CheckLanguage = False
    $WdLangID = Number(1033)

    If $WdLangID Then
        With $oRange
            .LanguageID = $WdLangID
            .NoProofing = False
        EndWith

    EndIf
EndFunc   ;==>_SetLanguage
Func _SetLanguage2()
    $sLang = "English"
    $oWordApp2.CheckLanguage = False
    $WdLangID = Number(1033)
    If $WdLangID Then
        With $oRange2
            .LanguageID = $WdLangID
            .NoProofing = False
        EndWith
    EndIf
EndFunc   ;==>_SetLanguage2

Func SendMessage()
    If BitAND(WinGetState($handle2), 2) Then
        GUISetState(@SW_HIDE, $Form1)
        GUISetState(@SW_DISABLE, $Form1)
        GUISwitch($Form2)
        GUISetState(@SW_ENABLE, $Form2)
        GUISetState(@SW_SHOW, $Form2)
    EndIf
    $change = StringStripWS(GUICtrlRead($Input1), 3)
    GUICtrlSetData($Input1, $change)
    $body = _GUICtrlEdit_GetText ($Edit1)
    ;_GUICtrlEdit_SetText($Edit1, "")
    ;$attach = StringStripCR ( $attach )
    $subject = StringStripWS ( GUICtrlRead($Input3), 3 )
    If $attach <> "" Then
        $split = StringSplit(StringTrimRight($attach, 1), ';')
        If @error Then
            SetError(0)
            $finattach = '-a:"' & StringTrimRight ( $attach, 1 ) & '" '
        Else
            $finattach = Null
            For $i = 1 To $split[0] Step 1
                $finattach = $finattach & '-a:"' & $split[$i] & '" '
            Next
        EndIf
    EndIf
    $body = StringReplace($body, @CRLF, "\n")
    $body = StringReplace ( $body, '"', '\"' )
    #cs
        $split = StringSplit ( $body, "", $STR_NOCOUNT )
        For $i = 0 To UBound ( $split ) - 1 Step 1
        If $split[$i] = Chr ( 10 ) Then
        $split[$i] = "\n"
        ElseIf $split[$i] = Chr ( 13 ) Then
        $split[$i] = Null
        Else
        ContinueLoop
        EndIf
        Next
        $body = _ArrayToString ( $split, "" )
        ConsoleWrite ( $body )
    #ce
    If StringRegExp(GUICtrlRead($Input1), "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$") = 1 Then
        If $attach = "" Then
            $proc = Run('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" -host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d', 'C:\ProgramData\chocolatey\bin', @SW_SHOW, $STDOUT_CHILD)
        Else
            $proc = Run('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" ' & $finattach & '-host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d', 'C:\ProgramData\chocolatey\bin', @SW_SHOW, $STDOUT_CHILD)
            ClipPut('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" ' & $finattach & '-host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d')
            ProcessWaitClose($proc)
            $text = StdoutRead($proc)
            ClipPut($text)
        EndIf

            MsgBox($MB_OK + $MB_SYSTEMMODAL, "Sent!", "Message Sent!!")
    Else
        MsgBox(16, "Not a valid email", "Enter a correct email address please")
    EndIf
EndFunc   ;==>SendMessage

Func _GetFilename($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.FileName
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilename

Func _GetFilenameExt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Extension
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameExt

Func _GetFilenameInt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Name
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameInt

Func _GetFilenameDrive($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return StringUpper($oObjectFile.Drive)
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameDrive

Func _GetFilenamePath($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Path
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenamePath

Func _Exit()
    _Word_Quit($oWordApp)
    _Word_Quit($oWordApp2)
    Exit
EndFunc   ;==>_Exit

 

Link to comment
Share on other sites

  • Moderators

MattHiggs,

You need to add the _GUIListViewEx_EventMonitor function inside your idle loop - without that the UDF does not monitor the various events within your ListView and so does not react to the user's various clicks and key presses. There is also no need to re-initialise and reset the EditStatus of the ListView once you have loaded the data.

Here is my version of your script (with a lot of it commented-out so that I could run it) which works fine for me - look for the <<<<<<<<<<<<<<<<<<<<<<<<< lines about #525:

#include <ListBoxConstants.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <ListViewConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GuiEdit.au3>
#include <GuiListBox.au3>
#include <Constants.au3>
#include "GUIListViewEx.au3"
#include <Word.au3>
#include <Array.au3>

;OnAutoItExitRegister("_Exit")

Global $trans = False

;_WordErrorHandlerRegister()
#cs
If Not FileExists(@MyDocumentsDir & "\settings.ini") Then
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("Name", "What is the name wou want the recipients of your messages to see in regards to the sender? (Should be your name)", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Name", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("Email address", "What is your email address or the email address of the account sending the mail?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("SMTP server", "What is the address of the SMTP server for your outgoing mail?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Port", "What is the port used by smtp server?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Port", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Username", "What is the username used to login to your email?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "User name", $sInputBoxAnswer)
    EndIf
    $sInputBoxAnswer = InputBox("Email Password", "What is the password used to login to your email?", "", " ")
    If @error = 1 Then
        Exit
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Password", $sInputBoxAnswer)
    EndIf
    If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_SYSTEMMODAL, "Proxy server?", "Does your network utilize a proxy server?")
    If $iMsgBoxAnswer = $IDYES Then
        $sInputBoxAnswer = InputBox("Proxy server", "What is the proxy server address?", "", " ")
        If @error = 1 Then
            Exit
        Else
            IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Proxy", $sInputBoxAnswer)
        EndIf
    Else
        IniWrite(@MyDocumentsDir & "\settings.ini", "Config", "Proxy", "False")
    EndIf
EndIf
Global $oWordApp = _Word_Create(False)
Global $oDoc = _Word_DocAdd($oWordApp)
Global $oRange = $oDoc.Range
Global $oWordApp2 = _Word_Create(False)
Global $oDoc2 = _Word_DocAdd($oWordApp2)
Global $oRange2 = $oDoc2.Range
Global $oSpellCollection, $oAlternateWords, $oSpellCollection2, $oAlternateWords2
OnAutoItExitRegister("_Exit")
HotKeySet("^d", "stylish")

#ce

Global $attach = ""
Global $array
Global $both = False
Global $both2 = False
;$sphand = _Spell_HunspellInit ( "C:\hunspell-en_US\en_US.aff", "C:\hunspell-en_US\en_US.dic" )

#cs
$Form2 = GUICreate("Form2", 406, 514, 320, 200, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
$handle = WinGetHandle($Form2)
$MenuItem1 = GUICtrlCreateMenu("configure")
$MenuItem2 = GUICtrlCreateMenuItem("Attachments", $MenuItem1)
$Label1 = GUICtrlCreateLabel("Email Address", 128, 0, 130, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 70, 32, 273, 21)
$Label2 = GUICtrlCreateLabel("Attachments (Can drag and drop below)", 27, 64, 351, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 32, 104, 337, 21, $ES_READONLY)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button9 = GUICtrlCreateButton("Add/Browse", 158, 136, 89, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Label4 = GUICtrlCreateLabel("Subject", 160, 184, 157, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 32, 216, 337, 21)
$Label3 = GUICtrlCreateLabel("Message", 160, 240, 172, 29)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Edit1 = GUICtrlCreateEdit("", 32, 272, 345, 153, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$Button1 = GUICtrlCreateButton("Send", 30, 440, 113, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("Save As Template", 160, 440, 105, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button6 = GUICtrlCreateButton("Use Template", 282, 440, 113, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
#ce

$Form5 = GUICreate("Dynamic Variables", 274, 290, 750, 514)
$ListView1 = GUICtrlCreateListView("Dynamic Variable|Value", 15, 5, 241, 241, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS) )
_GUICtrlListView_SetExtendedListViewStyle($ListView1, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 110)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 127)
$iLVIndex_1 = _GUIListViewEx_Init ( $ListView1 )
$iRet = _GUIListViewEx_SetEditStatus($iLVIndex_1, 1, 1)

#cs
$Form1 = GUICreate("Spell Check", 396, 360, 694, 220)
Global $handle2 = WinGetHandle($Form1)
$Label7 = GUICtrlCreateLabel("Subject", 162, 8, 70, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Listbox3 = GUICtrlCreateList("", 24, 40, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Listbox4 = GUICtrlCreateList("", 232, 40, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Label8 = GUICtrlCreateLabel("Body", 173, 136, 49, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Listbox1 = GUICtrlCreateList("", 24, 168, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Listbox2 = GUICtrlCreateList("", 232, 168, 137, 97, BitOR($LBS_NOTIFY, $LBS_EXTENDEDSEL, $LBS_HASSTRINGS, $WS_VSCROLL))
$Label9 = GUICtrlCreateLabel("Errors", 64, 272, 53, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Corrections", 256, 272, 96, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Send", 32, 313, 75, 25, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button5 = GUICtrlCreateButton("Correct Spelling", 152, 313, 83, 25, $BS_NOTIFY)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetCursor(-1, 0)
$Button4 = GUICtrlCreateButton("Cancel", 280, 313, 75, 25, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)

$Form3 = GUICreate("Form3", 286, 283, 192, 124)
$Label5 = GUICtrlCreateLabel("Attachments", 86, 8, 113, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$List1 = GUICtrlCreateList("", 16, 40, 249, 188, $LBS_NOTIFY + $WS_VSCROLL)
$Button7 = GUICtrlCreateButton("Delete", 40, 240, 81, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
$Button8 = GUICtrlCreateButton("Back", 160, 240, 81, 33, $BS_NOTIFY)
GUICtrlSetCursor(-1, 0)
#ce

$Form4 = GUICreate("Form4", 242, 95, 216, 123)
$Combo1 = GUICtrlCreateCombo("", 40, 56, 169, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))

GUICtrlSetData($Combo1, "1|2|3|4|5")

$Label6 = GUICtrlCreateLabel("Templates", 72, 8, 96, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")


_GUIListViewEx_MsgRegister()

GUISetState(@SW_SHOW, $Form4)
;GUISetState(@SW_DISABLE, $Form4)
;GUISetState(@SW_DISABLE, $Form3)
;GUISetState(@SW_DISABLE, $Form1)
;GUISetState(@SW_SHOW, $Form2)

;$aRect = _GUICtrlEdit_GetRECT($Edit1)
;$aRect[0] += 10
;$aRect[1] += 10
;$aRect[2] -= 10
;$aRect[3] -= 10
;_GUICtrlEdit_SetRECT($Edit1, $aRect)

While 1
    Global $nMsg = GUIGetMsg(1)
    Switch $nMsg[1]
        #cs
        Case $Form2
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    _Exit()
                Case $GUI_EVENT_DROPPED
                    Sleep(200)
                    $mult = StringSplit(GUICtrlRead($Input2), "|")
                    If @error Then
                        WinActivate($Form2)
                        WinWaitActive($Form2)
                        GUICtrlSetState($Input2, $GUI_FOCUS)
                        Send("{ENTER}", 0)
                    Else
                        For $v = 1 To $mult[0] Step 1
                            $attach = $attach & $mult[$v] & ";"
                        Next
                        GUICtrlSetData($Input2, "")
                        $sToolTipAnswer = ToolTip("The attachments were added!", Default, Default, "Success")
                        Sleep(3000)
                        ToolTip("")
                    EndIf

                Case $MenuItem2
                    GUISetState(@SW_HIDE, $Form2)
                    GUISetState(@SW_DISABLE, $Form2)
                    GUISwitch($Form3)
                    GUISetState(@SW_ENABLE, $Form3)
                    GUISetState(@SW_SHOW, $Form3)
                    If $attach <> "" Then
                        $array = StringSplit(StringTrimRight($attach, 1), ";")
                        If @error Then
                            SetError(0)
                            _GUICtrlListBox_AddString($List1, _GetFilename(StringTrimRight($attach, 1)) & "." & _GetFilenameExt(StringTrimRight($attach, 1)))
                        Else
                            For $l = 1 To $array[0] Step 1
                                _GUICtrlListBox_AddString($List1, _GetFilename($array[$l]) & "." & _GetFilenameExt($array[$l]))
                            Next
                        EndIf
                    Else
                        _GUICtrlListBox_AddString($List1, "You currently do not have any attachments.")
                    EndIf
                Case $Input2
                    $attach = $attach & GUICtrlRead($Input2) & ";"
                    GUICtrlSetData($Input2, "")
                    $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                    Sleep(3000)
                    ToolTip("")

                Case $Button9
                    If GUICtrlRead($Input2) <> "" Then
                        If FileExists(GUICtrlRead($Input2)) Then
                            $attach = $attach & GUICtrlRead($Input2) & ";"
                            GUICtrlSetData($Input2, "")
                            $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                            Sleep(3000)
                            ToolTip("")
                        Else
                            If Not IsDeclared("sToolTipAnswer") Then Local $sToolTipAnswer
                            $sToolTipAnswer = ToolTip("File name entered does not exist", Default, Default, "Failure", 0, 0)
                            Sleep(3000)
                            ToolTip("")
                        EndIf

                    Else
                        $file = FileOpenDialog("Choose the file you want to attach.", "", "All (*.*)", 7, "", $Form2)
                        If $file = "" Then

                        Else
                            $files = StringSplit($file, "|")
                            If @error Then
                                SetError(0)
                                $attach = $attach & $file & ";"
                                GUICtrlSetData($Input2, $file)
                                $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                                Sleep(1000)
                                ToolTip("")
                                GUICtrlSetData($Input2, "")
                            Else
                                For $p = 2 To $files[0] Step 1
                                    $attach = $attach & $files[1] & "\" & $files[$p] & ";"
                                Next
                                $sToolTipAnswer = ToolTip("The attachment was added!", Default, Default, "Success")
                                Sleep(1000)
                                ToolTip("")
                            EndIf
                        EndIf

                    EndIf
                Case $Button1
                    If StringRight(GUICtrlRead($Input3), 1) <> "." Or StringRight(GUICtrlRead($Input3), 1) <> "!" Or StringRight(GUICtrlRead($Input3), 1) <> "?" Or StringRight(GUICtrlRead($Input3), 1) <> " " Then
                        GUICtrlSetData($Input3, GUICtrlRead($Input3) & " ")
                    EndIf
                    ;_GUICtrlEdit_SetSel ( $Edit1, 0, -1 )
                    _SpellCheck()
                Case $Button2 ;save as template
                    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
                    $sInputBoxAnswer = InputBox("Template Name", "What do you want to name this template?", "", " ")
                    If @error = 1 Then

                    Else
                        $name = $sInputBoxAnswer
                        $num = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                        $num += 1
                        $bodcap = _GUICtrlEdit_GetText($Edit1)
                        $bodcap = StringReplace($bodcap, @CRLF, "\n")
                        $subcap = GUICtrlRead($Input3)
                        $attcap = $attach
                        Local $holdarr[5][2] = [[3, ""], ["Name", $name], ["Body", $bodcap], ["Subject", $subcap], ["Attachments", $attcap]]
                        IniWriteSection(@MyDocumentsDir & "\settings.ini", "Template " & $num, $holdarr)
                        IniWrite(@MyDocumentsDir & "\settings.ini", "Number", "Template", $num)
                        $sToolTipAnswer = ToolTip("The template was saved!", Default, Default, "Success")
                        Sleep(2000)
                        ToolTip("")
                    EndIf

                Case $Button6
                    GUISetState(@SW_HIDE, $Form2)
                    GUISetState(@SW_DISABLE, $Form2)
                    GUISwitch($Form3)
                    GUISetState(@SW_ENABLE, $Form4)
                    GUISetState(@SW_SHOW, $Form4)
                    $numag = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                    If $numag = 0 Then
                        MsgBox($MB_OK + $MB_ICONHAND, "No templates", "You have not configured any templates.")
                    Else
                        For $h = 1 To $numag Step 1
                            GUICtrlSetData($Combo1, IniRead(@MyDocumentsDir & "\settings.ini", "Template " & $h, "Name", "NA"))
                        Next
                    EndIf

            EndSwitch
        Case $Form1
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Form1)
                    GUISetState(@SW_DISABLE, $Form1)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                Case $Listbox1
                    ;_SpellCheck2 ()
                    _SpellingSuggestions()
                Case $Listbox2
                    GUICtrlSetState($Button5, $GUI_ENABLE)
                Case $Listbox3
                    ;_SpellCheck ()
                    _SpellingSuggestions2()
                Case $Listbox4
                    GUICtrlSetState($Button5, $GUI_ENABLE)
                Case $Button3
                    SendMessage()
                Case $Button4
                    GUISetState(@SW_HIDE, $Form1)
                    GUISetState(@SW_DISABLE, $Form1)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                Case $Button5
                    If _GUICtrlListBox_GetSelCount($Listbox4) > 0 Then
                        _ReplaceWord2()
                    EndIf
                    If _GUICtrlListBox_GetSelCount($Listbox2) > 0 Then
                        _ReplaceWord()
                    EndIf
                    _SpellCheck()
            EndSwitch
        Case $Form3
            ToolTip("")
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE, $Button8
                    ToolTip("")
                    GUISetState(@SW_HIDE, $Form3)
                    GUISetState(@SW_DISABLE, $Form3)
                    GUISwitch($Form2)
                    GUISetState(@SW_ENABLE, $Form2)
                    GUISetState(@SW_SHOW, $Form2)
                    If UBound($array) = 1 Then
                        $attach = ""
                    Else
                        $attach = ""
                        For $ff = 1 To UBound($array) - 1 Step 1
                            $attach = $attach & $array[$ff] & ";"
                        Next
                    EndIf
                    _GUICtrlListBox_ResetContent($List1)
                Case $List1
                    ToolTip("")
                Case $Button7
                    If _GUICtrlListBox_GetSelCount = -1 Then
                        $sToolTipAnswer = ToolTip("Select something to delete first numbnuts.", Default, Default, "Idiot")
                    Else
                        ToolTip("")
                        $seltext = _GUICtrlListBox_GetText($List1, _GUICtrlListBox_GetCurSel($List1))
                        For $ff = 1 To $array[0] Step 1
                            If StringInStr($array[$ff], $seltext) > 0 Then
                                _ArrayDelete($array, $ff)
                                _GUICtrlListBox_DeleteString($List1, _GUICtrlListBox_GetCurSel($List1))
                                ExitLoop
                            EndIf
                        Next
                    EndIf
            EndSwitch
        #ce


        Case $Form4
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    Exit
                    ;GUISetState(@SW_HIDE, $Form4)
                    ;GUISetState(@SW_DISABLE, $Form4)
                    ;GUISwitch($Form2)
                    ;GUISetState(@SW_ENABLE, $Form2)
                    ;GUISetState(@SW_SHOW, $Form2)
                Case $Combo1

                    $subcheck = True
                    #cs
                    $sec = ""
                    $numag2 = Int(IniRead(@MyDocumentsDir & "\settings.ini", "Number", "Template", "0"))
                    If $numag2 = 0 Then

                    Else
                        $use = GUICtrlRead($Combo1)
                        For $h = 1 To $numag2 Step 1
                            If StringCompare(IniRead(@MyDocumentsDir & "\settings.ini", "Template " & $h, "Name", "NA"), $use) = 0 Then
                                $sec = "Template " & $h
                                ExitLoop
                            Else
                                ContinueLoop
                            EndIf
                        Next
                        GUISetState(@SW_HIDE, $Form4)
                        GUISetState(@SW_DISABLE, $Form4)
                        GUISwitch($Form2)
                        GUISetState(@SW_ENABLE, $Form2)
                        GUISetState(@SW_SHOW, $Form2)
                        $attach = IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Attachments", "NA")
                        GUICtrlSetData($Input3, IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"))
                        $thetext = IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Body", "NA")
                        _GUICtrlEdit_SetText($Edit1, StringReplace($thetext, "\n", @CRLF))
                        $subcheck = True
                        $bodcheck = True
                        $loc1 = ""
                        $loc2 = ""
                        $hol = 1
                        While 1
                            $varcheck = StringInStr ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), "%", Default, $hol )
                            If $varcheck = 0 Or @error Then
                                SetError ( 0 )
                                ExitLoop
                            Else
                                $hol += 1
                                If StringMid ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), Int ( $varcheck ) - 1, 1 ) <> "\" Then
                                    $loc1 = $loc1 & $varcheck & ";"
                                Else
                                    ContinueLoop
                                EndIf
                            EndIf
                        WEnd
                        If $loc1 <> "" Then
                            $subcheck = True
                            $holsplit = StringSplit ( StringTrimRight ( $loc1, 1 ), ";", $STR_NOCOUNT )
                            $values = ""
                            For $i = 0 To UBound ( $holsplit ) - 1 Step 2
                                $values = $values & StringMid ( IniRead(@MyDocumentsDir & "\settings.ini", $sec, "Subject", "NA"), Int ( $holsplit[$i] ), ( Int ( $holsplit[$i+1] ) - Int ( $holsplit[$i] ) ) + 1 ) & ";"
                            Next
                        Else
                            $subcheck = False
                        EndIf


                        $hol = 1
                        While 1
                            $varcheck2 = StringInStr ( StringReplace($thetext, "\n", @CRLF), "%", Default, $hol )
                            If $varcheck2 = 0 Or @error Then
                                SetError ( 0 )
                                ExitLoop
                            Else
                                $hol += 1
                                If StringMid ( StringReplace($thetext, "\n", @CRLF), Int ( $varcheck2 ) - 1, 1 ) <> "\" Then
                                    $loc2 = $loc2 & $varcheck2 & ";"
                                Else
                                    ContinueLoop
                                EndIf
                            EndIf
                        WEnd
                        If $loc2 <> "" Then
                            $bodcheck = True
                            $holsplit = StringSplit ( StringTrimRight ( $loc2, 1 ), ";", $STR_NOCOUNT )
                            $values2 = ""
                            For $i = 0 To UBound ( $holsplit ) - 1 Step 2
                                $values2 = $values2 & StringMid ( StringReplace($thetext, "\n", @CRLF), Int ( $holsplit[$i] ), ( Int ( $holsplit[$i+1] ) - Int ( $holsplit[$i] ) ) + 1 ) & ";"
                            Next
                        Else
                            $bodcheck = False
                        EndIf

                        If $subcheck Or $bodcheck Then

                        #ce
                            GUISetState ( @SW_SHOW, $Form5 )
                            _GUIListViewEx_SetActive ( $iLVIndex_1 )

                            Local $arrr[2][2] = [[1, "A"], [2, "B"]]

                            _GUIListViewEx_Insert ( $arrr )

                            #cs
                            If $subcheck Then
                                $holsplit = StringSplit ( StringTrimRight ( $values, 1 ), ";", $STR_NOCOUNT )
                                For $i = 0 To UBound ( $holsplit ) - 1 Step 1
                                    Global $arrr[2] = [$holsplit[$i], StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 )]
                                    _GUIListViewEx_Insert ( $arrr )
                                    ;GUICtrlCreateListViewItem ( $holsplit[$i] & "|" & StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $ListView1 )
                                Next
                            EndIf
                            If $bodcheck Then
                                $holsplit = StringSplit ( StringTrimRight ( $values2, 1 ), ";", $STR_NOCOUNT )
                                For $i = 0 To UBound ( $holsplit ) - 1 Step 1
                                    Global $arrr[2] = [$holsplit[$i], StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 )]
                                    _GUIListViewEx_Insert ( $arrr )
                                    ;GUICtrlCreateListViewItem ( $holsplit[$i] & "|" & StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $ListView1 )
                                Next
                            EndIf

                            #ce

                            $ind = _GUIListViewEx_ReadToArray ( $ListView1 )
                            ;$iLVIndex_1 = _GUIListViewEx_Init ( $ListView1, $ind ) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Not required
                        ;_GUIListViewEx_SetEditStatus($iLVIndex_1, 1, 1)            ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Not required
                        ;GUISwitch ( $Form5 )
                        ;EndIf
                    ;EndIf
            EndSwitch
        Case $Form5
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState ( @SW_HIDE, $Form5 )
            EndSwitch

    EndSwitch


    _GUIListViewEx_EventMonitor() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Very much required !!!!!!!!!!!!!!!!!

WEnd

#cs
Func stylish()
    $thestyle = GUIGetStyle($handle)
    If $trans = False Then
        GUISetStyle(-1, $thestyle[1] + 32, $handle)
        WinSetTrans($handle, "", 170)
        $trans = True
    Else
        GUISetStyle(-1, $thestyle[1] - 32, $handle)
        WinSetTrans($handle, "", 255)
        $trans = False
    EndIf
EndFunc   ;==>stylish
Func GetHoveredHwnd()
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If IsArray($iRet) Then Return HWnd($iRet[0])
    Return SetError(1, 0, 0)
EndFunc   ;==>GetHoveredHwnd
Func _SpellCheck()
    Local $sText, $sText2, $sWord, $sWord2

    $both = False
    $pText = _GUICtrlEdit_GetText($Edit1)
    $oRange.Delete
    $oRange.InsertAfter($pText)
    _SetLanguage()
    $both2 = False
    $pText2 = GUICtrlRead($Input3)
    $oRange2.Delete
    $oRange2.InsertAfter($pText2)
    _SetLanguage2()

    $oSpellCollection = $oRange.SpellingErrors
    $oSpellCollection2 = $oRange2.SpellingErrors
    ;Local $argg[$oSpellCollection.Count]
    _GUICtrlListBox_ResetContent($Listbox1)
    _GUICtrlListBox_ResetContent($Listbox2)
    _GUICtrlListBox_ResetContent($Listbox3)
    _GUICtrlListBox_ResetContent($Listbox4)
    GUICtrlSetState($Button5, $GUI_DISABLE)
    If $oSpellCollection.Count > 0 Or $oSpellCollection2.Count > 0 Then
        If BitAND(WinGetState($handle), 2) Then
            If $trans = True Then
                stylish()
            EndIf
            GUISetState(@SW_DISABLE, $Form2)
            GUISetState(@SW_HIDE, $Form2)
            GUISwitch($Form1)
            GUISetState(@SW_SHOW, $Form1)
            GUISetState(@SW_ENABLE, $Form1)
        EndIf

        If $oSpellCollection.Count > 0 Then

            For $i = 1 To $oSpellCollection.Count
                _GUICtrlListBox_AddString($Listbox1, $oSpellCollection.Item($i).Text)
            Next
            ;_GUICtrlEdit_SetText($Edit1, $oRange.Text)
            ;GUICtrlSetData($Input3, $oRange2.Text)
        Else
            _GUICtrlListBox_AddString($Listbox1, "No spelling errors")
        EndIf
        If $oSpellCollection2.Count > 0 Then
            _GUICtrlListBox_ResetContent($Listbox3)
            _GUICtrlListBox_ResetContent($Listbox4)
            GUICtrlSetState($Button5, $GUI_DISABLE)
            For $p = 1 To $oSpellCollection2.Count
                _GUICtrlListBox_AddString($Listbox3, $oSpellCollection2.Item($p).Text)
            Next
            ;_GUICtrlEdit_SetText ($Edit1, $oRange.Text)
            ;GUICtrlSetData($Input3, $oRange2.Text)
        Else
            _GUICtrlListBox_AddString($Listbox3, "No spelling errors")
        EndIf

    Else
        _GUICtrlEdit_SetText ($Edit1, $oRange.Text)
        GUICtrlSetData($Input3, $oRange2.Text)
        SendMessage()
    EndIf

EndFunc   ;==>_SpellCheck


Func _SpellingSuggestions()
    Local $iWord, $ssWord
    ;
    _GUICtrlListBox_ResetContent($Listbox2)
    If _GUICtrlListBox_GetSelCount($Listbox4) = 0 Then
        GUICtrlSetState($Button5, $GUI_DISABLE)
    EndIf



    $iWord = _GUICtrlListBox_GetCurSel($Listbox1) + 1
    $ssWord = $oSpellCollection.Item($iWord).Text
    $oAlternateWords = $oWordApp.GetSpellingSuggestions($ssWord)



    If $oAlternateWords.Count > 0 Then
        For $v = 1 To $oAlternateWords.Count
            _GUICtrlListBox_AddString($Listbox2, $oAlternateWords.Item($v).Name)
        Next
    Else
        _GUICtrlListBox_AddString($Listbox2, "No suggestions.")
    EndIf
EndFunc   ;==>_SpellingSuggestions

Func _SpellingSuggestions2()
    Local $iWord2, $ssWord2
    ;
    _GUICtrlListBox_ResetContent($Listbox4)
    If _GUICtrlListBox_GetSelCount($Listbox2) = 0 Then
        GUICtrlSetState($Button5, $GUI_DISABLE)
    EndIf


    $iWord2 = _GUICtrlListBox_GetCurSel($Listbox3) + 1
    $ssWord2 = $oSpellCollection2.Item($iWord2).Text
    $oAlternateWords2 = $oWordApp2.GetSpellingSuggestions($ssWord2)



    If $oAlternateWords2.Count > 0 Then
        For $c = 1 To $oAlternateWords2.Count
            _GUICtrlListBox_AddString($Listbox4, $oAlternateWords2.Item($c).Name)
        Next
    Else
        _GUICtrlListBox_AddString($Listbox4, "No suggestions.")
    EndIf
EndFunc   ;==>_SpellingSuggestions2

Func _ReplaceWord()
    Local $iWord, $iNewWord, $sWord, $sNewWord, $sText, $sNewText
    ;
    $iWord = _GUICtrlListBox_GetCurSel($Listbox1) + 1
    $iNewWord = _GUICtrlListBox_GetCurSel($Listbox2) + 1
    If $iWord == $LB_ERR Or $iNewWord == $LB_ERR Then
        ;MsgBox(48, "Error", "You must first select a word to replace, then a replacement word.")
        ;Return
    Else
        $oSpellCollection.Item($iWord).Text = $oAlternateWords.Item($iNewWord).Name
        _GUICtrlEdit_SetText($Edit1, $oRange.Text)
    EndIf


EndFunc   ;==>_ReplaceWord
Func _ReplaceWord2()
    Local $iWord2, $iNewWord2, $sWord2, $sNewWord2, $sText2, $sNewText2
    ;
    $iWord2 = _GUICtrlListBox_GetCurSel($Listbox3) + 1
    $iNewWord2 = _GUICtrlListBox_GetCurSel($Listbox4) + 1
    If $iWord2 == $LB_ERR Or $iNewWord2 == $LB_ERR Then
        ;MsgBox(48, "Error", "You must first select a word to replace, then a replacement word.")
        ;Return
    Else
        $oSpellCollection2.Item($iWord2).Text = $oAlternateWords2.Item($iNewWord2).Name
        GUICtrlSetData($Input3, $oRange2.Text)
    EndIf


EndFunc   ;==>_ReplaceWord2

Func _SetLanguage()
    $sLang = "English"
    $oWordApp.CheckLanguage = False
    $WdLangID = Number(1033)

    If $WdLangID Then
        With $oRange
            .LanguageID = $WdLangID
            .NoProofing = False
        EndWith

    EndIf
EndFunc   ;==>_SetLanguage
Func _SetLanguage2()
    $sLang = "English"
    $oWordApp2.CheckLanguage = False
    $WdLangID = Number(1033)
    If $WdLangID Then
        With $oRange2
            .LanguageID = $WdLangID
            .NoProofing = False
        EndWith
    EndIf
EndFunc   ;==>_SetLanguage2

Func SendMessage()
    If BitAND(WinGetState($handle2), 2) Then
        GUISetState(@SW_HIDE, $Form1)
        GUISetState(@SW_DISABLE, $Form1)
        GUISwitch($Form2)
        GUISetState(@SW_ENABLE, $Form2)
        GUISetState(@SW_SHOW, $Form2)
    EndIf
    $change = StringStripWS(GUICtrlRead($Input1), 3)
    GUICtrlSetData($Input1, $change)
    $body = _GUICtrlEdit_GetText ($Edit1)
    ;_GUICtrlEdit_SetText($Edit1, "")
    ;$attach = StringStripCR ( $attach )
    $subject = StringStripWS ( GUICtrlRead($Input3), 3 )
    If $attach <> "" Then
        $split = StringSplit(StringTrimRight($attach, 1), ';')
        If @error Then
            SetError(0)
            $finattach = '-a:"' & StringTrimRight ( $attach, 1 ) & '" '
        Else
            $finattach = Null
            For $i = 1 To $split[0] Step 1
                $finattach = $finattach & '-a:"' & $split[$i] & '" '
            Next
        EndIf
    EndIf
    $body = StringReplace($body, @CRLF, "\n")
    $body = StringReplace ( $body, '"', '\"' )
    #ce
    #cs
        $split = StringSplit ( $body, "", $STR_NOCOUNT )
        For $i = 0 To UBound ( $split ) - 1 Step 1
        If $split[$i] = Chr ( 10 ) Then
        $split[$i] = "\n"
        ElseIf $split[$i] = Chr ( 13 ) Then
        $split[$i] = Null
        Else
        ContinueLoop
        EndIf
        Next
        $body = _ArrayToString ( $split, "" )
        ConsoleWrite ( $body )
    #ce
    #cs
    If StringRegExp(GUICtrlRead($Input1), "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$") = 1 Then
        If $attach = "" Then
            $proc = Run('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" -host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d', 'C:\ProgramData\chocolatey\bin', @SW_SHOW, $STDOUT_CHILD)
        Else
            $proc = Run('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" ' & $finattach & '-host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d', 'C:\ProgramData\chocolatey\bin', @SW_SHOW, $STDOUT_CHILD)
            ClipPut('CMail -from:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Email Address", "NA") & ':"' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Name", "NA") & '" -to:' & GUICtrlRead($Input1) & ' -subject:"' & $subject & '" -body:"' & $body & '" ' & $finattach & '-host:' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "User name", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Password", "NA") & '@' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "SMTP Server", "NA") & ':' & IniRead(@MyDocumentsDir & "\settings.ini", "Config", "Port", "NA") & ' -starttls -requiretls -d')
            ProcessWaitClose($proc)
            $text = StdoutRead($proc)
            ClipPut($text)
        EndIf

            MsgBox($MB_OK + $MB_SYSTEMMODAL, "Sent!", "Message Sent!!")
    Else
        MsgBox(16, "Not a valid email", "Enter a correct email address please")
    EndIf
EndFunc   ;==>SendMessage

Func _GetFilename($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.FileName
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilename

Func _GetFilenameExt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Extension
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameExt

Func _GetFilenameInt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Name
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameInt

Func _GetFilenameDrive($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return StringUpper($oObjectFile.Drive)
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameDrive

Func _GetFilenamePath($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Path
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenamePath

Func _Exit()
    _Word_Quit($oWordApp)
    _Word_Quit($oWordApp2)
    Exit
    EndFunc   ;==>_Exit
    #ce

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

MattHiggs,

Glad I could help. In future when you reply, could you please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads this already long thread unnecessarily.

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

MattHiggs,

No problem. And I have amended the "Beginner's Guide" to make it clearer that the _EventMonitor function is essential if you want to edit the ListView, so thanks for the push to do so.

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

Hi Melba23,

is there a way with your awesome UDF to limit UpDown of each row individually?

As per your previously provided example to me, you set limit per column. Unfortunately i do need limit per row.

Any chance this can be somehow done?

I am failing to figure this one out...

Thanks

Jan

Edited by JanZoudlik
Link to comment
Share on other sites

  • Moderators

JanZoudlik,

Alas, NO. But as in a similar case a few pages back, by using the array returned by the _EventMonitor function, you could always check the new value after the edit and , if necessary, inform the user that the value selected is not acceptable for that particular row while resetting the original value. Best I can do I am afraid.

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

  • 2 weeks later...

Hi Melba,

I am having a hard time figuring out why my script won't let me edit a new item (empty) that I add to the list view. Can you see what I am missing please? Here is my code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <GUIListView.au3>
#include <AD.au3>
#include <Array.au3>
#include <_ArrayEX.au3>
#include <String.au3>
#include <GUIListViewEx.au3>
#include <GuiTab.au3>
#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

_AddNewUser()

Func _AddNewUser()
    Local $iEditMode = 0
    #Region ### START Koda GUI section ### Form=
    $formNU = GUICreate("Create New User", 890, 750, -1, -1)
    $grpNUUser = GUICtrlCreateGroup("User Information", 16, 16, 857, 205)
    $rNUAddUser = GUICtrlCreateRadio("Add a single user", 24, 40, 113, 17)
    $rNUImportFile = GUICtrlCreateRadio("Import User File", 200, 40, 113, 17)
    $rNUAddMultiUsers = GUICtrlCreateRadio("Add Multiple Users", 360, 40, 113, 17)
    $lblNUFileImport = GUICtrlCreateLabel("Import File",26,72,52,17)
    $inNUFileImport = GUICtrlCreateInput("",88,69,550,17)
    $btnNUBrowse = GUICtrlCreateButton("Browse",650,66,75,25)
    $lblNUUsername = GUICtrlCreateLabel("Username", 26, 122, 52, 17)
    $inNUUsername = GUICtrlCreateInput("", 88, 119, 121, 21)
    $lblNUFullname = GUICtrlCreateLabel("FullName", 239, 122, 48, 17)
    $inNUFullName = GUICtrlCreateInput("", 303, 119, 121, 21)
    $lblNUFirstName = GUICtrlCreateLabel("FirstName", 453, 122, 51, 17)
    $inNUFirstName = GUICtrlCreateInput("", 517, 119, 121, 21)
    $lblNULastName = GUICtrlCreateLabel("LastName", 668, 122, 52, 17)
    $inNULastName = GUICtrlCreateInput("", 732, 119, 121, 21)
    $lblNUPW = GUICtrlCreateLabel("Password", 26, 154, 50, 17)
    $inNUPW = GUICtrlCreateInput("", 88, 151, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    $lblNUDescription = GUICtrlCreateLabel("Description", 239, 154, 57, 17)
    $inNUDescription = GUICtrlCreateInput("", 303, 151, 121, 21)
    $lblNUCompany = GUICtrlCreateLabel("Company", 453, 154, 48, 17)
    $inNUCompany = GUICtrlCreateInput("", 517, 151, 121, 21)
    $lblNUOffice = GUICtrlCreateLabel("Office", 668, 154, 32, 17)
    $inNUOffice = GUICtrlCreateInput("", 732, 151, 121, 21)
    $lblNUTel = GUICtrlCreateLabel("Telephone", 26, 185, 55, 17)
    $inNUTel = GUICtrlCreateInput("", 88, 182, 121, 21)
    $lblNUTitle = GUICtrlCreateLabel("Job Title", 239, 185, 44, 17)
    $inNUTitle = GUICtrlCreateInput("", 303, 182, 121, 21)
    $lblNUGroups = GUICtrlCreateLabel("Group Membership", 453, 185, 93, 17)
    $inNUGroups = GUICtrlCreateInput("", 549, 182, 305, 21)
    GUICtrlSetTip(-1, "Separate the groups with a ; ( Do not use a space before or after the ;)")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpNUList = GUICtrlCreateGroup("User List", 16, 242, 857, 465)
    $listNU = GUICtrlCreateListView("Username|FullName|FirstName|LastName|Password|Description|Company|Office|Telephone|Job Title|Group Membership", 32, 265, 825, 422, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnNURemove = GUICtrlCreateButton("Remove", 545, 715, 75, 25)
    $btnNUAdd = GUICtrlCreateButton("Add", 630, 715, 75, 25)
    $btnNUCreate = GUICtrlCreateButton("Create", 715, 715, 75, 25)
    $btnNUExit = GUICtrlCreateButton("Exit", 800, 715, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    GUICtrlSetState($rNUAddUser, $GUI_CHECKED)
    GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
    GUICtrlSetState($btnNURemove,$GUI_DISABLE)
    GUICtrlSetState($listNU,$GUI_DISABLE)
    GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
    GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
    GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
    _GUIListViewEx_MsgRegister()
    $lvNUIndex = _GUIListViewEx_Init($listNU,"", 0, 0, False, 1 + 2 + 4 + 8 + 512)
    _GUIListViewEx_SetEditStatus($lvNUIndex,"*")

    While 10
        Sleep(10)
        If $radioCheck1 = False And BitAND(GUICtrlRead($rNUAddUser), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","Computer selected")
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_DISABLE)
            GUICtrlSetState($lblNUUsername,$GUI_ENABLE)
            GUICtrlSetState($inNUUsername,$GUI_ENABLE)
            GUICtrlSetState($lblNUFullname,$GUI_ENABLE)
            GUICtrlSetState($inNUFullname,$GUI_ENABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($inNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($lblNULastName,$GUI_ENABLE)
            GUICtrlSetState($inNULastName,$GUI_ENABLE)
            GUICtrlSetState($lblNUPW,$GUI_ENABLE)
            GUICtrlSetState($inNUPW,$GUI_ENABLE)
            GUICtrlSetState($lblNUDescription,$GUI_ENABLE)
            GUICtrlSetState($inNUDescription,$GUI_ENABLE)
            GUICtrlSetState($lblNUCompany,$GUI_ENABLE)
            GUICtrlSetState($inNUCompany,$GUI_ENABLE)
            GUICtrlSetState($lblNUOffice,$GUI_ENABLE)
            GUICtrlSetState($inNUOffice,$GUI_ENABLE)
            GUICtrlSetState($lblNUTel,$GUI_ENABLE)
            GUICtrlSetState($inNUTel,$GUI_ENABLE)
            GUICtrlSetState($lblNUTitle,$GUI_ENABLE)
            GUICtrlSetState($inNUTitle,$GUI_ENABLE)
            GUICtrlSetState($lblNUGroups,$GUI_ENABLE)
            GUICtrlSetState($inNUGroups,$GUI_ENABLE)
            GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
            GUICtrlSetState($btnNURemove,$GUI_DISABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = True
            $radioCheck2 = False
            $radioCheck3 = False
        ElseIf $radioCheck2 = False And BitAND(GUICtrlRead($rNUImportFile), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($inNUFullname,$GUI_DISABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_ENABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_ENABLE)
            GUICtrlSetState($inNUFileImport,$GUI_ENABLE)
            $radioCheck1 = False
            $radioCheck2 = True
            $radioCheck3 = False
        ElseIf $radioCheck3 = False And BitAND(GUICtrlRead($rNUAddMultiUsers), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($inNUFullname,$GUI_DISABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = False
            $radioCheck2 = False
            $radioCheck3 = True
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($formNU)
                _GUIListViewEx_Close($lvNUIndex)
                ExitLoop
            Case $btnNUExit
                GUIDelete($formNU)
                _GUIListViewEx_Close($lvNUIndex)
                ExitLoop
            Case $btnNUAdd
                $aRet = _GUIListViewEx_ReturnArray($lvNUIndex,3)
                If IsArray($aRet) Then
                    _ArrayDisplay($aRet)
                    If UBound($aRet) = 0 Then
                        _GUIListViewEx_Insert("")
                        #cs
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",1)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",2)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",3)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",4)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",5)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",6)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",7)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",8)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",9)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",10)
                        _GUICtrlListView_AddSubItem($listNU,UBound($aRet) + 1,"",11)
                        #ce
                    Else
                        _ArrayDisplay($aRet)
                        ;_GUICtrlListView_InsertItem($listNU,"",$
                    EndIf
                EndIf

        EndSwitch
        _GUIListViewEx_EventMonitor()
    WEnd

EndFunc

Some of the includes are for other parts of the script, so feel free to comment those out if you want to run this.

I am running the latest version of your UDF. 

I am trying to have the listview where i can double click on the column and add the data that I want, and then if I want to add a new row I just click on the add button and it will add a new row to the bottom of the listview. I'm just having a hard time right now being able to edit the row that I add.

I tried using _GUICtrlListView_AddSubItem to add empty content because I though that I couldn't edit it because there was an item in the column to edit, but that didn't work. I commented that part out.

if you have any ideas why this isn't working i'd appreciate the help.

Thanks,

Jeff

Link to comment
Share on other sites

  • Moderators

HurleyShanabarger,

You need to set the ListView to use user header colours (add 16 to $iAdded when initialising) and set the required combo data in the $aHdrData array. Open example 6 and make the following changes:

Line #49

$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 0, 0, True, 1 + 8 + 32 + 16) ; 16 added

Lines #63-73

; Set header data
Global $aHdrData[][] = [["Tom",               "Dick",              "Harry",           "Fred"], _                ; As colour is enabled, these will replace original titles
                         ["0xFF8080;0x8888FF", "0xFEFEFE;0x000000", "",                "0xFFFF00;0x00FF80"], _  ; Col 2 will use default colours
                         ["",                  "",                  @TAB & "H1|H2|H3", ""], _                   ; Col 2 readonly combo; Col 1 & 3 text
                         [0,                   0,                   100,               0]]                      ; Col 2 not resizeable - fixed 100 pixel width

;Global $aHdrData[][] = [[Default, "", "",  ""], _
;                       ["", Default, "",  ""], _
;                       ["", "", "",  Default], _
;                       [0,  0,  Default, 0]]
_GUIListViewEx_LoadHdrData($iLVIndex_1, $aHdrData)

; basically replacing the simple header with something a little more complex

Let me know if you still have problems.

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

jazzyjeff,

Looking into your problem now.

M23

Edit: You need to add the new row using the UDF - this works for me:

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

_AddNewUser()

Func _AddNewUser()
    Local $iEditMode = 0
    $formNU = GUICreate("Create New User", 890, 750, -1, -1)

    $grpNUList = GUICtrlCreateGroup("User List", 16, 242, 857, 465)
    $listNU = GUICtrlCreateListView("Username|FullName|FirstName|LastName|Password|Description|Company|Office|Telephone|Job Title|Group Membership", 32, 265, 825, 422, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))

    $btnNUAdd = GUICtrlCreateButton("Add", 630, 715, 75, 25)
    $btnNUExit = GUICtrlCreateButton("Exit", 800, 715, 75, 25)

    GUISetState(@SW_SHOW)

    _GUIListViewEx_MsgRegister()
    $lvNUIndex = _GUIListViewEx_Init($listNU,"", 0, 0, False, 1 + 2 + 4 + 8 + 512)
    _GUIListViewEx_SetEditStatus($lvNUIndex,"*")

    While 10
        ; Sleep(10) - no need if you use GUIGetMsg

        ; Removed code

        $nMsg = GUIGetMsg()
        Switch $nMsg

            Case $GUI_EVENT_CLOSE, $btnNUExit ; You can have multiple expressions on one line
                GUIDelete($formNU)
                _GUIListViewEx_Close($lvNUIndex)
                ExitLoop

            Case $btnNUAdd
                ; Insert a row at the bottom of the ListView
                _GUIListViewEx_InsertSpec($lvNUIndex, -1, "")

        EndSwitch
        _GUIListViewEx_EventMonitor()
    WEnd

EndFunc

I added a couple of other comments too.

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

jazzyjeff,

Glad I could help.

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

Hey Melba,

II'm sorry to bug you again on this, but I'm running into road blocks on this code again. So if I import data into the list view, I am then no longer able to add or edit new rows. Would you be able to look at this code that has been slightly modified to see why I cannot edit cells when content has been added in the for loop?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <GUIListView.au3>
#include <AD.au3>
#include <Array.au3>
#include <_ArrayEX.au3>
#include <String.au3>
#include <GUIListViewEx.au3>
#include <GuiTab.au3>
#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

_AddNewUser()

Func _AddNewUser()
    Local $iEditMode = 0, $arrayNUFI
    #Region ### START Koda GUI section ### Form=
    $formNU = GUICreate("Create New User", 890, 750, -1, -1)
    $grpNUUser = GUICtrlCreateGroup("User Information", 16, 16, 857, 205)
    $rNUAddUser = GUICtrlCreateRadio("Add a single user", 24, 40, 113, 17)
    $rNUImportFile = GUICtrlCreateRadio("Import User File", 200, 40, 113, 17)
    $rNUAddMultiUsers = GUICtrlCreateRadio("Add Multiple Users", 360, 40, 113, 17)
    $lblNUFileImport = GUICtrlCreateLabel("Import File",26,72,52,17)
    $inNUFileImport = GUICtrlCreateInput("",88,69,550,17)
    $btnNUBrowse = GUICtrlCreateButton("Browse",650,66,75,25)
    $btnNUImport = GUICtrlCreateButton("Import",735,66,75,25)
    $lblNUUsername = GUICtrlCreateLabel("Username", 26, 122, 52, 17)
    $inNUUsername = GUICtrlCreateInput("", 88, 119, 121, 21)
    $lblNUFullname = GUICtrlCreateLabel("FullName", 239, 122, 48, 17)
    $cbNUFullname = GUICtrlCreateCombo("", 303, 119, 121, 21)
    $lblNUFirstName = GUICtrlCreateLabel("FirstName", 453, 122, 51, 17)
    $inNUFirstName = GUICtrlCreateInput("", 517, 119, 121, 21)
    $lblNULastName = GUICtrlCreateLabel("LastName", 668, 122, 52, 17)
    $inNULastName = GUICtrlCreateInput("", 732, 119, 121, 21)
    $lblNUPW = GUICtrlCreateLabel("Password", 26, 154, 50, 17)
    $inNUPW = GUICtrlCreateInput("", 88, 151, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    $lblNUDescription = GUICtrlCreateLabel("Description", 239, 154, 57, 17)
    $inNUDescription = GUICtrlCreateInput("", 303, 151, 121, 21)
    $lblNUCompany = GUICtrlCreateLabel("Company", 453, 154, 48, 17)
    $inNUCompany = GUICtrlCreateInput("", 517, 151, 121, 21)
    $lblNUOffice = GUICtrlCreateLabel("Office", 668, 154, 32, 17)
    $inNUOffice = GUICtrlCreateInput("", 732, 151, 121, 21)
    $lblNUTel = GUICtrlCreateLabel("Telephone", 26, 185, 55, 17)
    $inNUTel = GUICtrlCreateInput("", 88, 182, 121, 21)
    $lblNUTitle = GUICtrlCreateLabel("Job Title", 239, 185, 44, 17)
    $inNUTitle = GUICtrlCreateInput("", 303, 182, 121, 21)
    $lblNUGroups = GUICtrlCreateLabel("Group Membership", 453, 185, 93, 17)
    $inNUGroups = GUICtrlCreateInput("", 549, 182, 305, 21)
    GUICtrlSetTip(-1, "Separate the groups with a ; ( Do not use a space before or after the ;)")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpNUList = GUICtrlCreateGroup("User List", 16, 242, 857, 465)
    $listNU = GUICtrlCreateListView("Username|FullName|FirstName|LastName|Password|Description|Company|Office|Telephone|Job Title|Group Membership", 32, 265, 825, 422, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnNURemove = GUICtrlCreateButton("Remove", 545, 715, 75, 25)
    $btnNUAdd = GUICtrlCreateButton("Add", 630, 715, 75, 25)
    $btnNUCreate = GUICtrlCreateButton("Create", 715, 715, 75, 25)
    $btnNUExit = GUICtrlCreateButton("Exit", 800, 715, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    GUICtrlSetState($rNUAddUser, $GUI_CHECKED)
    GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
    GUICtrlSetState($btnNURemove,$GUI_DISABLE)
    GUICtrlSetState($listNU,$GUI_DISABLE)
    GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
    GUICtrlSetState($btnNUImport,$GUI_DISABLE)
    GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
    GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
    GUICtrlSetData($cbNUFullName,"Firstname Lastname|Lastname, Firstname","Firstname Lastname")
    _GUIListViewEx_MsgRegister()
    $lvNUIndex = _GUIListViewEx_Init($listNU,"", 0, 0, False, 1 + 2 + 4 + 8 + 512)
    _GUIListViewEx_SetEditStatus($lvNUIndex,"*")

    While 10
        If $radioCheck1 = False And BitAND(GUICtrlRead($rNUAddUser), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","Computer selected")
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_DISABLE)
            GUICtrlSetState($lblNUUsername,$GUI_ENABLE)
            GUICtrlSetState($inNUUsername,$GUI_ENABLE)
            GUICtrlSetState($lblNUFullname,$GUI_ENABLE)
            GUICtrlSetState($cbNUFullname,$GUI_ENABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($inNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($lblNULastName,$GUI_ENABLE)
            GUICtrlSetState($inNULastName,$GUI_ENABLE)
            GUICtrlSetState($lblNUPW,$GUI_ENABLE)
            GUICtrlSetState($inNUPW,$GUI_ENABLE)
            GUICtrlSetState($lblNUDescription,$GUI_ENABLE)
            GUICtrlSetState($inNUDescription,$GUI_ENABLE)
            GUICtrlSetState($lblNUCompany,$GUI_ENABLE)
            GUICtrlSetState($inNUCompany,$GUI_ENABLE)
            GUICtrlSetState($lblNUOffice,$GUI_ENABLE)
            GUICtrlSetState($inNUOffice,$GUI_ENABLE)
            GUICtrlSetState($lblNUTel,$GUI_ENABLE)
            GUICtrlSetState($inNUTel,$GUI_ENABLE)
            GUICtrlSetState($lblNUTitle,$GUI_ENABLE)
            GUICtrlSetState($inNUTitle,$GUI_ENABLE)
            GUICtrlSetState($lblNUGroups,$GUI_ENABLE)
            GUICtrlSetState($inNUGroups,$GUI_ENABLE)
            GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
            GUICtrlSetState($btnNURemove,$GUI_DISABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($btnNUImport,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = True
            $radioCheck2 = False
            $radioCheck3 = False
        ElseIf $radioCheck2 = False And BitAND(GUICtrlRead($rNUImportFile), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($cbNUFullname,$GUI_ENABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_ENABLE)
            GUICtrlSetState($btnNUImport,$GUI_ENABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_ENABLE)
            GUICtrlSetState($inNUFileImport,$GUI_ENABLE)
            $radioCheck1 = False
            $radioCheck2 = True
            $radioCheck3 = False
        ElseIf $radioCheck3 = False And BitAND(GUICtrlRead($rNUAddMultiUsers), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($cbNUFullname,$GUI_DISABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($btnNUImport,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = False
            $radioCheck2 = False
            $radioCheck3 = True
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE,$btnNUExit
                GUIDelete($formNU)
                _GUIListViewEx_Close($lvNUIndex)
                ExitLoop
            Case $btnNUAdd
                _GUIListViewEx_InsertSpec($lvNUIndex, -1, "")
            Case $btnNUBrowse
                GUICtrlSetData($inNUFileImport,FileOpenDialog("Select CSV File","C:\","CSV (*.csv)"))
            Case $btnNUImport
                #Region --- CodeWizard generated code Start ---
                ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question
                If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(36,"File Import","Please ensure that the CSV file you are importing contains at minimum the following fields in this order:" & @CRLF & @CRLF & "Username | Firstname | Lastname | Password" & @CRLF & @CRLF & "Additional fields can be added, but these are the minimum and must be first." & @CRLF & @CRLF & "Are you sure you want to continue?")
                Select
                    Case $iMsgBoxAnswer = 6 ;Yes
                        $nuFileImport = GUICtrlRead($inNUFileImport)
                        _FileReadToArray($nuFileImport,$arrayNUFI,1,",")
                        _ArrayDisplay($arrayNUFI)
                        For $i = 1 To $arrayNUFI[0][0]
                            If GUICtrlRead($cbNUFullname) = "Lastname, Firstname" Then
                                _GUIListViewEx_InsertSpec($lvNUIndex,-1,$arrayNUFI[$i][0] & "|" & $arrayNUFI[$i][2] & ", " & $arrayNUFI[$i][1] & "|" & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][3] & "|" & $arrayNUFI[$i][4] & "|" & $arrayNUFI[$i][5] & "|" & $arrayNUFI[$i][6] & "|" & $arrayNUFI[$i][7] & "|" & $arrayNUFI[$i][8])
                            Else
                                _GUIListViewEx_InsertSpec($lvNUIndex,-1,$arrayNUFI[$i][0] & "|" & $arrayNUFI[$i][1] & " " & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][3] & "|" & $arrayNUFI[$i][4] & "|" & $arrayNUFI[$i][5] & "|" & $arrayNUFI[$i][6] & "|" & $arrayNUFI[$i][7] & "|" & $arrayNUFI[$i][8])
                            EndIf
                        Next
                    Case $iMsgBoxAnswer = 7 ;No

                EndSelect
                #EndRegion --- CodeWizard generated code End ---

        EndSwitch
        _GUIListViewEx_EventMonitor()
    WEnd

EndFunc

I have attached a test csv file that you could use to test the import.

Thanks, and I appreciate any help you can offer.

adAccounts.csv

Link to comment
Share on other sites

  • Moderators

jazzyjeff,

Your code works fine for me - all cells are editable whether imported or added in any order. What exactly do you see?

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

Sorry Melba. I hadn't ran the code the way I posted it here. I though the issue was just with the specific function that I posted. My real script actually has a GUI, which then launches another window (The function posted).

This code should replicate what I have, and I have tested it to replicate the issue I am experiencing.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <GUIListView.au3>
#include <AD.au3>
#include <Array.au3>
#include <_ArrayEX.au3>
#include <String.au3>
#include <GUIListViewEx.au3>
#include <GuiTab.au3>
#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

$formMain = GUICreate("Test",150,150)
$btnGUI = GUICtrlCreateButton("Run GUI",20,20,100,100)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnGUI
            _AddNewUser()
    EndSwitch
WEnd

Func _AddNewUser()
    Local $iEditMode = 0, $arrayNUFI
    Local $radioCheck1=True,$radioCheck2=False,$radioCheck3=False
    #Region ### START Koda GUI section ### Form=
    $formNU = GUICreate("Create New User", 890, 750, -1, -1)
    $grpNUUser = GUICtrlCreateGroup("User Information", 16, 16, 857, 205)
    $rNUAddUser = GUICtrlCreateRadio("Add a single user", 24, 40, 113, 17)
    $rNUImportFile = GUICtrlCreateRadio("Import User File", 200, 40, 113, 17)
    $rNUAddMultiUsers = GUICtrlCreateRadio("Add Multiple Users", 360, 40, 113, 17)
    $lblNUFileImport = GUICtrlCreateLabel("Import File",26,72,52,17)
    $inNUFileImport = GUICtrlCreateInput("",88,69,550,17)
    $btnNUBrowse = GUICtrlCreateButton("Browse",650,66,75,25)
    $btnNUImport = GUICtrlCreateButton("Import",735,66,75,25)
    $lblNUUsername = GUICtrlCreateLabel("Username", 26, 122, 52, 17)
    $inNUUsername = GUICtrlCreateInput("", 88, 119, 121, 21)
    $lblNUFullname = GUICtrlCreateLabel("FullName", 239, 122, 48, 17)
    $cbNUFullname = GUICtrlCreateCombo("", 303, 119, 121, 21)
    $lblNUFirstName = GUICtrlCreateLabel("FirstName", 453, 122, 51, 17)
    $inNUFirstName = GUICtrlCreateInput("", 517, 119, 121, 21)
    $lblNULastName = GUICtrlCreateLabel("LastName", 668, 122, 52, 17)
    $inNULastName = GUICtrlCreateInput("", 732, 119, 121, 21)
    $lblNUPW = GUICtrlCreateLabel("Password", 26, 154, 50, 17)
    $inNUPW = GUICtrlCreateInput("", 88, 151, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    $lblNUDescription = GUICtrlCreateLabel("Description", 239, 154, 57, 17)
    $inNUDescription = GUICtrlCreateInput("", 303, 151, 121, 21)
    $lblNUCompany = GUICtrlCreateLabel("Company", 453, 154, 48, 17)
    $inNUCompany = GUICtrlCreateInput("", 517, 151, 121, 21)
    $lblNUOffice = GUICtrlCreateLabel("Office", 668, 154, 32, 17)
    $inNUOffice = GUICtrlCreateInput("", 732, 151, 121, 21)
    $lblNUTel = GUICtrlCreateLabel("Telephone", 26, 185, 55, 17)
    $inNUTel = GUICtrlCreateInput("", 88, 182, 121, 21)
    $lblNUTitle = GUICtrlCreateLabel("Job Title", 239, 185, 44, 17)
    $inNUTitle = GUICtrlCreateInput("", 303, 182, 121, 21)
    $lblNUGroups = GUICtrlCreateLabel("Group Membership", 453, 185, 93, 17)
    $inNUGroups = GUICtrlCreateInput("", 549, 182, 305, 21)
    GUICtrlSetTip(-1, "Separate the groups with a ; ( Do not use a space before or after the ;)")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpNUList = GUICtrlCreateGroup("User List", 16, 242, 857, 465)
    $listNU = GUICtrlCreateListView("Username|FullName|FirstName|LastName|Password|Description|Company|Office|Telephone|Job Title|Group Membership", 32, 265, 825, 422, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnNURemove = GUICtrlCreateButton("Remove", 545, 715, 75, 25)
    $btnNUAdd = GUICtrlCreateButton("Add", 630, 715, 75, 25)
    $btnNUCreate = GUICtrlCreateButton("Create", 715, 715, 75, 25)
    $btnNUExit = GUICtrlCreateButton("Exit", 800, 715, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    GUICtrlSetState($rNUAddUser, $GUI_CHECKED)
    GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
    GUICtrlSetState($btnNURemove,$GUI_DISABLE)
    GUICtrlSetState($listNU,$GUI_DISABLE)
    GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
    GUICtrlSetState($btnNUImport,$GUI_DISABLE)
    GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
    GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
    GUICtrlSetData($cbNUFullName,"Firstname Lastname|Lastname, Firstname","Firstname Lastname")
    _GUIListViewEx_MsgRegister()
    $lvNUIndex = _GUIListViewEx_Init($listNU,"", 0, 0, False, 1 + 2 + 4 + 8 + 512)
    _GUIListViewEx_SetEditStatus($lvNUIndex,"*")

    While 10
        If $radioCheck1 = False And BitAND(GUICtrlRead($rNUAddUser), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","Computer selected")
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_DISABLE)
            GUICtrlSetState($lblNUUsername,$GUI_ENABLE)
            GUICtrlSetState($inNUUsername,$GUI_ENABLE)
            GUICtrlSetState($lblNUFullname,$GUI_ENABLE)
            GUICtrlSetState($cbNUFullname,$GUI_ENABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($inNUFirstName,$GUI_ENABLE)
            GUICtrlSetState($lblNULastName,$GUI_ENABLE)
            GUICtrlSetState($inNULastName,$GUI_ENABLE)
            GUICtrlSetState($lblNUPW,$GUI_ENABLE)
            GUICtrlSetState($inNUPW,$GUI_ENABLE)
            GUICtrlSetState($lblNUDescription,$GUI_ENABLE)
            GUICtrlSetState($inNUDescription,$GUI_ENABLE)
            GUICtrlSetState($lblNUCompany,$GUI_ENABLE)
            GUICtrlSetState($inNUCompany,$GUI_ENABLE)
            GUICtrlSetState($lblNUOffice,$GUI_ENABLE)
            GUICtrlSetState($inNUOffice,$GUI_ENABLE)
            GUICtrlSetState($lblNUTel,$GUI_ENABLE)
            GUICtrlSetState($inNUTel,$GUI_ENABLE)
            GUICtrlSetState($lblNUTitle,$GUI_ENABLE)
            GUICtrlSetState($inNUTitle,$GUI_ENABLE)
            GUICtrlSetState($lblNUGroups,$GUI_ENABLE)
            GUICtrlSetState($inNUGroups,$GUI_ENABLE)
            GUICtrlSetState($btnNUAdd,$GUI_DISABLE)
            GUICtrlSetState($btnNURemove,$GUI_DISABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($btnNUImport,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = True
            $radioCheck2 = False
            $radioCheck3 = False
        ElseIf $radioCheck2 = False And BitAND(GUICtrlRead($rNUImportFile), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUAddMultiUsers, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($cbNUFullname,$GUI_ENABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_ENABLE)
            GUICtrlSetState($btnNUImport,$GUI_ENABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_ENABLE)
            GUICtrlSetState($inNUFileImport,$GUI_ENABLE)
            $radioCheck1 = False
            $radioCheck2 = True
            $radioCheck3 = False
        ElseIf $radioCheck3 = False And BitAND(GUICtrlRead($rNUAddMultiUsers), $GUI_CHECKED) = $GUI_CHECKED Then
            ;MsgBox(0,"","File list selected")
            GUICtrlSetState($rNUAddUser, $GUI_UNCHECKED)
            GUICtrlSetState($rNUImportFile, $GUI_UNCHECKED)
            GUICtrlSetState($listNU,$GUI_ENABLE)
            GUICtrlSetState($lblNUUsername,$GUI_DISABLE)
            GUICtrlSetState($inNUUsername,$GUI_DISABLE)
            GUICtrlSetState($lblNUFullname,$GUI_DISABLE)
            GUICtrlSetState($cbNUFullname,$GUI_DISABLE)
            GUICtrlSetState($lblNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($inNUFirstName,$GUI_DISABLE)
            GUICtrlSetState($lblNULastName,$GUI_DISABLE)
            GUICtrlSetState($inNULastName,$GUI_DISABLE)
            GUICtrlSetState($lblNUPW,$GUI_DISABLE)
            GUICtrlSetState($inNUPW,$GUI_DISABLE)
            GUICtrlSetState($lblNUDescription,$GUI_DISABLE)
            GUICtrlSetState($inNUDescription,$GUI_DISABLE)
            GUICtrlSetState($lblNUCompany,$GUI_DISABLE)
            GUICtrlSetState($inNUCompany,$GUI_DISABLE)
            GUICtrlSetState($lblNUOffice,$GUI_DISABLE)
            GUICtrlSetState($inNUOffice,$GUI_DISABLE)
            GUICtrlSetState($lblNUTel,$GUI_DISABLE)
            GUICtrlSetState($inNUTel,$GUI_DISABLE)
            GUICtrlSetState($lblNUTitle,$GUI_DISABLE)
            GUICtrlSetState($inNUTitle,$GUI_DISABLE)
            GUICtrlSetState($lblNUGroups,$GUI_DISABLE)
            GUICtrlSetState($inNUGroups,$GUI_DISABLE)
            GUICtrlSetState($btnNUAdd,$GUI_ENABLE)
            GUICtrlSetState($btnNURemove,$GUI_ENABLE)
            GUICtrlSetState($btnNUBrowse,$GUI_DISABLE)
            GUICtrlSetState($btnNUImport,$GUI_DISABLE)
            GUICtrlSetState($lblNUFileImport,$GUI_DISABLE)
            GUICtrlSetState($inNUFileImport,$GUI_DISABLE)
            $radioCheck1 = False
            $radioCheck2 = False
            $radioCheck3 = True
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE,$btnNUExit
                GUIDelete($formNU)
                _GUIListViewEx_Close($lvNUIndex)
                ExitLoop
            Case $btnNUAdd
                _GUIListViewEx_InsertSpec($lvNUIndex, -1, "")
            Case $btnNUBrowse
                GUICtrlSetData($inNUFileImport,FileOpenDialog("Select CSV File","C:\","CSV (*.csv)"))
            Case $btnNUImport
                #Region --- CodeWizard generated code Start ---
                ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question
                If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(36,"File Import","Please ensure that the CSV file you are importing contains at minimum the following fields in this order:" & @CRLF & @CRLF & "Username | Firstname | Lastname | Password" & @CRLF & @CRLF & "Additional fields can be added, but these are the minimum and must be first." & @CRLF & @CRLF & "Are you sure you want to continue?")
                Select
                    Case $iMsgBoxAnswer = 6 ;Yes
                        $nuFileImport = GUICtrlRead($inNUFileImport)
                        _FileReadToArray($nuFileImport,$arrayNUFI,1,",")
                        _ArrayDisplay($arrayNUFI)
                        For $i = 1 To $arrayNUFI[0][0]
                            If GUICtrlRead($cbNUFullname) = "Lastname, Firstname" Then
                                _GUIListViewEx_InsertSpec($lvNUIndex,-1,$arrayNUFI[$i][0] & "|" & $arrayNUFI[$i][2] & ", " & $arrayNUFI[$i][1] & "|" & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][3] & "|" & $arrayNUFI[$i][4] & "|" & $arrayNUFI[$i][5] & "|" & $arrayNUFI[$i][6] & "|" & $arrayNUFI[$i][7] & "|" & $arrayNUFI[$i][8])
                            Else
                                _GUIListViewEx_InsertSpec($lvNUIndex,-1,$arrayNUFI[$i][0] & "|" & $arrayNUFI[$i][1] & " " & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][2] & "|" & $arrayNUFI[$i][3] & "|" & $arrayNUFI[$i][4] & "|" & $arrayNUFI[$i][5] & "|" & $arrayNUFI[$i][6] & "|" & $arrayNUFI[$i][7] & "|" & $arrayNUFI[$i][8])
                            EndIf
                        Next
                    Case $iMsgBoxAnswer = 7 ;No

                EndSelect
                #EndRegion --- CodeWizard generated code End ---

        EndSwitch
        _GUIListViewEx_EventMonitor()
    WEnd

EndFunc

Sorry i didn't post my realy code, I think it is just too much content that is unnecessary. Like I say though, this code replicates the issue. When you click in the cells, they cannot be edited.

Link to comment
Share on other sites

  • Moderators

jazzyjeff,

It is the _ArrayDisplay call that is causing the problem, but as yet I cannot see why. Debugging proceeding.....

M23

Edit:

The _ArrayDisplay call is, unsurprisingly, resetting the current GUI to the _ArrayDisplay GUI - but when the GUI is deleted the current GUI is not being reset to the previous GUI as I would expect, but left blank. As a result, when the GUIListViewEx UDF tries to create its temporary edit control within the ListView it fails. This is a very surprising find and I am now trying to understand why it happens - and more importantly how to work around it. Stay tuned!

Edit 2:

I knew I had come across this before - I asked about it 7 years ago in this thread and never really got an answer. The problem arises because you have 2 GUIs in the script and so AutoIt does not know which one you want to be the "current" one when next creating controls. As there seems little chance of changing this behaviour I will have to modify the GUIListViewEx UDF to make sure it knows which GUI is the current one in which to create the temporary edit control - that should not be too difficult. And I also came across another little "gotcha" in the UDF which I will fix at the same time. Back shortly.....

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

  • Melba23 changed the title to GUIListViewEx - BugFix Version 6 Apr 24

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