TheXman Posted September 25, 2017 Share Posted September 25, 2017 Got it. Thanks Melba23! CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
MattHiggs Posted October 2, 2017 Share Posted October 2, 2017 I think I may have found a bug. I have a script which is comprised of two windows. One of these windows has a list view control in it, and I used this udf to allow the user to double click and modify a particular list view item. While I was running the script, something strange happened. When I double clicked one of the list view items to modify, the input control which allows you to change the value in the list view did not appear in the list view window, but in the other window: Maybe I did something wrong, but I don't think I did. Please advise. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2017 Author Moderators Share Posted October 2, 2017 MattHiggs, Quote Please advise Post the code! Otherwise I cannot hope to debug a UDF as complex as this one. And were you using the latest UDF release or an earlier one? I ask because I have added a GUISwitch to the latest version which should prevent exactly this problem. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MattHiggs Posted October 2, 2017 Share Posted October 2, 2017 28 minutes ago, Melba23 said: MattHiggs, Post the code! Otherwise I cannot hope to debug a UDF as complex as this one. And were you using the latest UDF release or an earlier one? I ask because I have added a GUISwitch to the latest version which should prevent exactly this problem. M23 expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #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] = [StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $holsplit[$i]] _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] = [StringTrimLeft ( StringTrimRight ( $holsplit[$i], 1 ), 1 ), $holsplit[$i]] _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 $vRet = _GUIListViewEx_EventMonitor() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 1 If $vRet <> "" Then $row = $vRet[1][0] $col = $vRet[1][1] $before = $vRet[1][2] $after = $vRet[1][3] $rep = StringReplace ( GUICtrlRead ( $Input3 ), $before, $after, Default, $STR_CASESENSE ) GUICtrlSetData ( $Input3, $rep ) $rep2 = StringReplace ( _GUICtrlEdit_GetText ( $Edit1 ), $before, $after, Default, $STR_CASESENSE ) _GUICtrlEdit_SetText ( $Edit1, $rep2 ) EndIf 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 More sharing options...
Moderators Melba23 Posted October 3, 2017 Author Moderators Share Posted October 3, 2017 (edited) MattHiggs, Close to a 1000 lines of completely uncommented code with 5 active GUIS - and you expect me to debug something inside my UDF when it is totally unclear exactly where in all the spaghetti the ListView editing process is actually called? Plus the fact that I cannot run the code as it is written because of all the dependencies hard wired into it. However, having looked at the code I can see that you are continually calling GUISwitch when you are hiding/showing all those GUIs as events occur. I would suggest that this is the cause of your problems as by doing this you are resetting the GUI in which AutoIt will automatically create any controls - known as the "current" GUI. So I think you are clicking the ListView in the "active" GUI, but then AutoIt is creating the temporary edit control used to edit the ListView in the "current" GUI which has been set by your last GUISwitch call and not its own. That is why I asked if you were using the most recent version of the UDF as a problem not unlike this was the cause of a recent modification - the UDF sets its own GUI as the "current" one when the editing process has started. However, in your case, you require the "current" GUI to remain "current" post-edit and so I will have to further modify the UDF to reset the previous "current" GUI once the UDF editing process has competed. Give me a while to look into how I can do this and I will post a Beta UDF version for you to test. M23 Edit: Try this Beta UDF code and see if it fixes the problem: Incidentally, as the function concerned had but a single exit point it was really easy to reset the "current" GUI - good coding practice shows once again that it is "good" for a reason! Edited May 10, 2020 by Melba23 Beta code removed 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 16, 2017 Author Moderators Share Posted October 16, 2017 [NEW VERSION] - 15 Oct 17 Changed: A previous update forced the ListView GUI to be set as the "current" GUI for control creation - and of course this upset some scripts which wanted to create further controls in another GUI after a ListView edit. So now the UDF forces the ListView GUI to be "current" GUI during an edit, but once it is completed it resets the "current" GUI to the window which was "current" beforehand. New UDF, examples and beginners' guide in the first post. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Skysnake Posted October 25, 2017 Share Posted October 25, 2017 What does "Event error 3" mean? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 25, 2017 Author Moderators Share Posted October 25, 2017 Skysnake, I am not altogether sure to what you are referring, but from the _EventMonitor function header: ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_EventMonitor ; [...] ; Return values .: Success: ; [...] ; Failure: Sets @error as follows when editing: ; 1 - Invalid EditMode parameter ; 2 - Empty ListView ; 3 - Column not editable So I imagine the error is because the column you have tried to edit has not been set as an editable column using _SetEditStatus. As always, seeing some code might help me give you some more focused advice. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Skysnake Posted October 25, 2017 Share Posted October 25, 2017 Thank you, this helps. I will have a look. Would it be possible to change the MsgBox display from "Event Error 3" to actually displaying "Column not editable" ...? Thanks a lot. Skysnake Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 25, 2017 Author Moderators Share Posted October 25, 2017 Skysnake, My UDF produces no MsgBoxes - it merely sets the @error macro when there is a problem. So there is something else happening here - some other code is producing that MsgBox. Perhaps (as I have already mentioned) posting the code will help to get you a solution. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rony2006 Posted October 26, 2017 Share Posted October 26, 2017 @Melba23 Hello, Can you tell me please how can I add grinds to a listview? I tried the following code but nothing happens: $lista = _GUICtrlListView_Create($D2E_v01, "",20,130,650,444,BitOR($LVS_DEFAULT,$LVS_EX_GRIDLINES)) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 26, 2017 Author Moderators Share Posted October 26, 2017 rony2006, As its name implies ($LVS_EX_GRIDLINES) that is an extended style - and so you need to use _GUICtrlListView_SetExtendedListViewStyle to set it: $lista = _GUICtrlListView_Create($D2E_v01, "",20,130,650,444) _GUICtrlListView_SetExtendedListViewStyle($lista, $LVS_EX_GRIDLINES) And in future, please only post UDF-related questions in this thread, not general ListView help questions. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 26, 2017 Author Moderators Share Posted October 26, 2017 Skysnake, A light dawns! Are you asking about the MsgBox that appears in the Example scripts that come with the UDF? If so than I have no intention of changing the content - I explain clearly in the function headers what the error values signify and it is a useful exercise for the student (as my old maths master used to say) to search them for a more detailed explanation of the error which occurred. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Skysnake Posted October 27, 2017 Share Posted October 27, 2017 Dear @Melba23, yes, quite understood. My only point was presenting the user with "can not be edited" is more user friendly that "error 3 has occurred". I will leave it at that. Thank you. I will be posting an example later on for your perusal and comments. Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Skysnake Posted October 27, 2017 Share Posted October 27, 2017 I do not need most of all the fancy tricks in your very impressive UDF I DO need to allow user input, but not free-form. Only as per the pre-set combos. This I plundered from somewhere else, the link is in the header. Then I updated it to show my 2nd Combo. Also I customized the WM function. Is this suitable to be plugged into any other script? expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Modified by Skysnake Script Function: User input in ListView with combo's https://www.autoitscript.com/forum/topic/119224-combobox-inside-listview-item/?do=findComment&comment=828742 #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <ComboConstants.au3> Opt("TrayIconDebug", 1) ; We use ESC to exit the temporary Combo Opt("GUICloseOnESC", 0) ; Set flag to indicate double click in ListView Global $fDblClk = False ; Declare global variables Global $aLV_Click_Info, $hTmp_Combo = 0, $hTmp_Combo_Gender = 0 Local $clrPink = 0XF1CCFF, $clrBlue = 0xCCFFF1 ; Open DLL for _IsPressed $dll = DllOpen("user32.dll") ; Create GUI $hGUI = GUICreate("Test", 400, 250) $hListView = _GUICtrlListView_Create($hGUI, "Name|Species|Gender", 10, 10, 242, 200) _GUICtrlListView_AddItem($hListView, "Blu", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Dog", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Male", 2) _GUICtrlListView_AddItem($hListView, "Pearl", 1) _GUICtrlListView_AddItem($hListView, "Snowy", 2) _GUICtrlListView_AddItem($hListView, "Tweetie", 3) GUISetState() ; Look for double clicks GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_CMBinLV") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DllClose($dll) Exit EndSwitch ; If a temporary combo exists If $hTmp_Combo <> 0 Then ; If ENTER pressed If _IsPressed("0D", $dll) Then ; Set label to edit content $sText = GUICtrlRead($hTmp_Combo) _GUICtrlListView_SetItemText($hListView, $aLV_Click_Info[0], $sText, $aLV_Click_Info[1]) ; Delete temporary combo GUICtrlDelete($hTmp_Combo) $hTmp_Combo = 0 GUICtrlSetState($hListView, $GUI_ENABLE) EndIf ; If ESC pressed If _IsPressed("1B", $dll) Then ; Delete temporary combo GUICtrlDelete($hTmp_Combo) $hTmp_Combo = 0 GUICtrlSetState($hListView, $GUI_ENABLE) EndIf EndIf ; If a temporary combo exists $hTmp_Combo_Gender If $hTmp_Combo_Gender <> 0 Then ; If ENTER pressed If _IsPressed("0D", $dll) Then ; Set label to edit content $sText = GUICtrlRead($hTmp_Combo_Gender) _GUICtrlListView_SetItemText($hListView, $aLV_Click_Info[0], $sText, $aLV_Click_Info[1]) ; Delete temporary combo GUICtrlDelete($hTmp_Combo_Gender) $hTmp_Combo_Gender = 0 GUICtrlSetState($hListView, $GUI_ENABLE) EndIf ; If ESC pressed If _IsPressed("1B", $dll) Then ; Delete temporary combo GUICtrlDelete($hTmp_Combo_Gender) $hTmp_Combo_Gender = 0 GUICtrlSetState($hListView, $GUI_ENABLE) EndIf EndIf ; If an item was double clicked If $fDblClk Then $fDblClk = False ; Delete an existing temporary combo GUICtrlDelete($hTmp_Combo) ; Get label position Switch $aLV_Click_Info[1] Case 0 ; On Item ConsoleWrite("115 Item " & $aLV_Click_Info[1]) $aLV_Rect_Info = _GUICtrlListView_GetItemRect($hListView, $aLV_Click_Info[0], 2) Case Else ; On SubItem ConsoleWrite("118 SubItem " & $aLV_Click_Info[1]) $aLV_Rect_Info = _GUICtrlListView_GetSubItemRect($hListView, $aLV_Click_Info[0], $aLV_Click_Info[1]) EndSwitch If StringRight($aLV_Click_Info[1], 1) = 1 Then ; Create temporary combo $hTmp_Combo = GUICtrlCreateCombo("", $aLV_Rect_Info[0] + 10, $aLV_Rect_Info[1] + 10, 100, $aLV_Rect_Info[3] - $aLV_Rect_Info[1], $CBS_DROPDOWNLIST) GUICtrlSetData($hTmp_Combo, "Dog|Cat|Bird") GUICtrlSetState($hListView, $GUI_DISABLE) GUICtrlSetState($hTmp_Combo, BitOR($GUI_FOCUS, $GUI_ONTOP)) EndIf If StringRight($aLV_Click_Info[1], 1) = 2 Then ;ConsoleWrite("$aLV_Click_Info"&_ArrayDisplay ($aLV_Click_Info)&@CRLF) ; Create temporary combo $hTmp_Combo_Gender = GUICtrlCreateCombo("", $aLV_Rect_Info[0] + 10, $aLV_Rect_Info[1] + 10, 100, $aLV_Rect_Info[3] - $aLV_Rect_Info[1], $CBS_DROPDOWNLIST) GUICtrlSetData($hTmp_Combo_Gender, "Male|Female") GUICtrlSetState($hListView, $GUI_DISABLE) GUICtrlSetState($hTmp_Combo_Gender, BitOR($GUI_FOCUS, $GUI_ONTOP)) EndIf EndIf WEnd Func WM_NOTIFY_CMBinLV($hWnd, $iMsg, $iwParam, $ilParam) ; If a combo exists, return immediately If $hTmp_Combo <> 0 Then Return $GUI_RUNDEFMSG If $hTmp_Combo_Gender <> 0 Then Return $GUI_RUNDEFMSG Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hListView And DllStructGetData($tNMHDR, "Code") = $NM_DBLCLK Then $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($hListView) ; As long as the click was on an item or subitem If $aLV_Click_Info[0] <> -1 Then $fDblClk = True EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY_CMBinLV Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Skysnake Posted October 27, 2017 Share Posted October 27, 2017 (edited) I want to be able to add color. I have read your Guide and think my needs are much simpler. If I add a column, how do I paint inside that cell? GUICtrlListView_CreateSolidBitMap() I do not need to update an entire item (row) - painting inside a single cell will be sufficient... Is there an easy way to do that? Googled, but did not find much... $hListView = _GUICtrlListView_Create($hGUI, "Name|Species|Gender|Color", 10, 10, 300, 200) _GUICtrlListView_AddItem($hListView, "Blu", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Dog", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Male", 2) Local $hmyclr = _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16) _GUICtrlListView_AddSubItem($hListView, 0, $hmyclr, 3) _GUICtrlListView_AddItem($hListView, "Pearl", 1) _GUICtrlListView_AddItem($hListView, "Snowy", 2) _GUICtrlListView_AddItem($hListView, "Tweetie", 3) Returns Exactly like Guinness says here... Quote Or why not use small icons/bitmaps, search _GUICtrlListView_CreateSolidBitMap() in the Help File. This is what I have done in the past to show if (for example) a file has copied or not (green/red) Except that I honestly don't understand what the HelpFile example is doing ______________________________ This is a little like thinking out loud. Should I read the relevant cells into an array, then build an array of color from to op to bottom and then apply? Like this? $hListView = _GUICtrlListView_Create($hGUI, "Name|Species|Gender|Color", 10, 10, 300, 200) _GUICtrlListView_AddItem($hListView, "Blu", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Dog", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Male", 2) _GUICtrlListView_AddSubItem($hListView, 0, "", 3) _GUICtrlListView_AddItem($hListView, "Pearl", 1) _GUICtrlListView_AddItem($hListView, "Snowy", 2) _GUICtrlListView_AddItem($hListView, "Tweetie", 3) ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), $clrBlue, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFFFFFF, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFFFFFF, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), $clrPink, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) $hImage = '' ; reset image... :) There are two questions here... How do I draw that SolidBitmap inside a specific cell? Will create images as an array and apply to ListView work? Thanks again Edited October 27, 2017 by Skysnake Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2017 Author Moderators Share Posted October 27, 2017 (edited) Skysnake, As I said to another poster just above, if you want to ask questions which do not specifically involve this UDF then please post in the open forum and leave this thread uncluttered. As neither of your posts above fall into this category I will be removing them shortly, as well as this rejoinder. M23 Edit: But here is how you can use the UDF to have a column (2) which uses a combo to limit user edit options and a right-click menu to select the colour of another column (1) of the selected row. Not terribly difficult after all: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> #include "GUIListViewEx.au3" Global $iYellow = "0xFFFF00", _ $iLtBlue = "0xCCCCFF", _ $iGreen = "0x00FF00", _ $iBlack = "0x000000", _ $iRed = "0xFF0000", _ $iBlue = "0x0000FF", _ $iWhite = "0xFFFFFF" Global $sRet $hGUI = GUICreate("Coloured ListView Example", 500, 300) ; Create ListView $cLV = GUICtrlCreateListView("Column 0|Colourable|Editable|Column 3", 10, 10, 480, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth($cLV, $i, 100) Next ; Initiate ListView = user colours $iLVIndex = _GUIListViewEx_Init($cLV, "", 0, 0, True, 32) ; Set deafult colours to use Global $aDefCols[4] = ["0x000000", "0xFEFEFE", "0xFFFFFF", "0x0000FF"] _GUIListViewEx_SetDefColours($iLVIndex, $aDefCols) ; Set column edit status _GUIListViewEx_SetEditStatus($iLVIndex, 2, 2, "1|2|3", True) ; 2 = Read-only combo ; If colours used then this function must be run BEFORE GUISetState _GUIListViewEx_MsgRegister() GUISetState() ; Create array and fill listview Global $aLVArray[6][4] For $i = 0 To 5 $sData = "Item " & $i & "-0" $aLVArray[$i][0] = $sData For $j = 1 To 3 $sData &= "|SubItem " & $i & "-" & $j $aLVArray[$i][$j] = "SubItem " & $i & "-" & $j Next _GUIListViewEx_InsertSpec($iLVIndex, 0, $sData) Next ; Create context menu for native ListView $mContextmenu = GUICtrlCreateContextMenu($cLV) $mWhtTxt = GUICtrlCreateMenuItem("White text", $mContextmenu) $mYelTxt = GUICtrlCreateMenuItem("Yellow text", $mContextmenu) $mBluTxt = GUICtrlCreateMenuItem("Cyan text", $mContextmenu) $mGrnTxt = GUICtrlCreateMenuItem("Green text", $mContextmenu) $mBlkTxt = GUICtrlCreateMenuItem("Black text", $mContextmenu) GUICtrlCreateMenuItem("", $mContextmenu) $mWhtFld = GUICtrlCreateMenuItem("White field", $mContextmenu) $mRedFld = GUICtrlCreateMenuItem("Red field", $mContextmenu) $mBluFld = GUICtrlCreateMenuItem("Blue field", $mContextmenu) $mGrnFld = GUICtrlCreateMenuItem("Green field", $mContextmenu) $mBlkFld = GUICtrlCreateMenuItem("Black field", $mContextmenu) GUICtrlCreateMenuItem("", $mContextmenu) $mDefTxt = GUICtrlCreateMenuItem("Default txt", $mContextmenu) $mDefFld = GUICtrlCreateMenuItem("Default field", $mContextmenu) $mDefBoth = GUICtrlCreateMenuItem("Default both", $mContextmenu) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $mWhtTxt To $mDefBoth ; Check context menu items _SetColour($iMsg) EndSwitch $vRet = _GUIListViewEx_EventMonitor() WEnd Func _SetColour($iCID) ; Get information on where last right click occurred within ListView Local $aContext = _GUIListViewEx_ContextPos() ; Set new colour required Local $sColSet = "", $aColArray, $aSplit, $fDef = False Switch $iCID Case $mWhtTxt $sColSet = $iWhite & ";" ; Text colour followed by ";" Case $mYelTxt $sColSet = $iYellow & ";" Case $mBluTxt $sColSet = $iLtBlue & ";" Case $mGrnTxt $sColSet = $iGreen & ";" Case $mBlkTxt $sColSet = $iBlack & ";" Case $mWhtFld $sColSet = ";" & $iWhite ; Field colour preceded by ";" Case $mRedFld $sColSet = ";" & $iRed Case $mBluFld $sColSet = ";" & $iBlue Case $mGrnFld $sColSet = ";" & $iGreen Case $mBlkFld $sColSet = ";" & $iBlack Case $mDefTxt ; Get current colours $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2) ; Extract current colours $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";") ; Create required setting $sColSet = ";" & $aSplit[2] ; Set default flag $fDef = True Case $mDefFld $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2) $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";") $sColSet = $aSplit[1] & ";" $fDef = True Case $mDefBoth $sColSet = ";" EndSwitch If $sColSet Then ; Reset to default if needed If $fDef Then _GUIListViewEx_SetColour($aContext[0], ";", $aContext[1], 1) EndIf ; Set required item colour _GUIListViewEx_SetColour($aContext[0], $sColSet, $aContext[1], 1) EndIf EndFunc Edited October 27, 2017 by Melba23 Skysnake and robertocm 2 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Skysnake Posted October 27, 2017 Share Posted October 27, 2017 You are brilliant! Thank you Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Biatu Posted January 5, 2018 Share Posted January 5, 2018 Is there any way to embed a functioning button control in a listview item? What is what? What is what. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2018 Author Moderators Share Posted January 6, 2018 Biatu, Quite possibly, but I have no intention of adding such a functionality to this UDF. Why not just react when the item is double-clicked? M23 Earthshine 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now