trescon

GUIdelete

9 posts in this topic

Good morning, I have a question for experts.

When I go to a sub form, with

Case $GUI_EVENT_CLOSE
            GUIDelete ($Form2)
            ExitLoop

to return to the main form the variables that I acquired with

GUICtrlCreateInput

GUICtrlCreateCombo

They are automatically reset or is their content?

Thank you


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites



trescon,

The variables will stll hold the ControlIds of the now-deleted controls - and these ControlIDs will be reused if you create further controls as they are just integer indices to an internal AutoIt array which keeps track of native created controls. So you need to be very careful NOT to reuse those variables (unless they have been reassigned) as the ControlIDs they hold may well not apply to the controls you think they do.

Please ask if you have any further questions.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Thanks Melba23.

Now I would have another question to ask.
Let's pretend we have a GUI with several input, some others are only GUICtrlCreateInput and GUICtrlCreateCombo.
We say now that I have populated all fields, and except I have to reset the interface fields for the next entry.
If I make a Sub where I reset all variabilie (ex. $Color = "") and then return to the GUI to populate the fields I am the GUI is cleared, but I find it empty all our curtains COMBO.
How can I do then to do a refresh of the screen without ruining it.


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

As clear as mud. But peering into the murk, is this what you want to know?

#include <GUIConstantsEx.au3>

$sComboData = "|1|2|3|4|5" ; Note leading "|" to replace existing data

$hGUI = GUICreate("Test", 500, 500)

$cInput = GUICtrlCreateInput("", 10, 10, 200, 20)

$cCombo = GUICtrlCreateCombo("", 10, 100, 200, 20)
GUICtrlSetData($cCombo, $sComboData)

GUICtrlCreateLabel("Add something to the input and select something in the combo", 10, 200, 480, 20)

$cClear = GUICtrlCreateButton("Clear controls", 10, 300, 120, 30)
GUICtrlSetState($cClear, $GUI_DISABLE)

GUISetState()

$bFilled = False

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cClear
            GUICtrlSetData($cInput, "")             ; Clear the input
            GUICtrlSetData($cCombo, $sComboData)    ; Clear the combo by reloading it
            
            $bFilled = False
            GUICtrlSetState($cClear, $GUI_DISABLE)

    EndSwitch

    If GUICtrlRead($cInput) And GUICtrlRead($cCombo) And Not $bFilled Then
        $bFilled = True
        GUICtrlSetState($cClear, $GUI_ENABLE)
    EndIf

WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Thanks Melba23.
The practice I associate the choices of the combo to a variable and when I want to reset the gui I rebind the variable combo.
Simple and obvious, for who knows.
From this you can understand that I am a beginner.
Thank you
Again


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

Glad the crystal ball was working!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Hello Melba23, I did as you suggested.
The only difference is that the allocation and zeroing of the combos I've included in a Func called by a Call.
I have the problem that after the zeroing and the return to the insertion, the number of references of the combo doubles zero (in practice appear twice in a row reference numbers, and are also selectable).
In more 'when I reset the input field remains the combo with the last previous selection (not empty as startup progam).
Zeroing is because all of the input variables are reset.
Where am I wrong ??
Thank you

Alberto

---------------

Ita : Salve Melba23, ho fatto come mi hai suggerito.
L'unica differenza è che l'assegnazione e l'azzeramento delle combo io le ho inserite in un Func richiamata da una Call.
Ho il problema che dopo l'azzeramento e il ritorno all'inserimento, il numero di referenze della combo azzerata raddoppia (in pratica vengono visualizzate due volte di fila le referenze , e risultano pure selezionabili).
In piu' quando azzero, il campo input della combo resta con l'ultima selezione precedente (non vuoto come all'avvio del progamma).
L'azzeramento avviene perchè tutte le variabili delle input si resettano.
Dove sbaglio ??
Grazie


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

$Marca = GUICtrlCreateCombo("", 40, 50, 130, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Marca, $MarcaDati)

Reset :

GUICtrlSetData($Marca,"")

GUICtrlSetData($Marca,$MarcaDati)

 

I think I understand.
I must not only re-sell combo but I also have to clear the variable GUICtrlCreateCombo.
Right?

Alberto

 


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

the number of references of the combo doubles zero (in practice appear twice in a row reference numbers

Did you notice this comment in the example I posted: 

$sComboData = "|1|2|3|4|5" ; Note leading "|" to replace existing data

If you do not have the leading "|" then you just add to the existing data - which I what I understand you to be saying.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • crushyna
      By crushyna
      Hi everyone!
      I'm developing small testing tool for new software in my company.
      Tool itself is working correctly (it follows scripted test commands one by one), but I'm trying to develop an error checking function.

      Mechanics are simple: every time software (external) shows specific error (via window class), program asks for next step. Continue, or abort test (and return to main GUI)?
      The error check function is switched on/off via Checkbox in GUI.

      Here are some code fragments:

      Checkbox:
      Global $idCheckbox1 = GUICtrlCreateCheckbox("Enable TP.net error handling", 352, 40, 249, 17) GUICtrlSetFont(-1, 12, 400, 0, "Calibri") GUICtrlSetColor(-1, 0x000000)  
      Checkbox switch:
      GUISetState(@SW_SHOW) Local $Choosen While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idCheckbox1 If _IsChecked($idCheckbox1) Then $cSwitch1 = 1 Else $cSwitch1 = 0 EndIf Case $idAddTest (and so on...)  
      Function call:
      (alot of ElseIf commands...) ElseIf $aItem = $idOperatorIn Then WywolanieOkna() WinActivate($hFSO) ControlClick($hFSO, "", "[NAME:lblCashierNumber]") Sleep($Sleep_05) Send("0000019{Enter}19{Enter 2}") Sleep($Sleep_75) EndIf #EndRegion ### START ELSEIF ARMY ### Next If $cSwitch1 = 1 Then MsgBox( 0, "Error check!", "Error check ON!") /// just for testing purposes CheckError() Else Return EndIf EndSwitch WEnd
      Classic _IsChecked function:
      Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked  
      And Checkerror() function itself:
      Func CheckError() Local $Answer If ControlCommand($hMsgPanel, "", "[NAME:panelMsgBox]", "IsEnabled", "") Then ;~ Sleep($Sleep_05) $Answer = MsgBox(52, "Error!", "An error occured! Continue testing?") ;~ Sleep($Sleep_05) Switch $Answer Case 6 MsgBox(0, "Error!", "Test will now continue.", 3) Send("{Enter}") WinActivate($hWnd) Return Case 7 MsgBox(64, "Error!", "Test cancelled.", 5) $ElseIfArmyOff = 1 ControlClick($hMsgPanel, "", "[NAME:cmdOK]") WinActivate($AppName) #cs MsgBox( 0, "test1", $idTSList) Local $idTSListCopy For $i = 0 to _GUICtrlListView_GetItemCount($idTSList) - 1\ #ce $idTSListCopy = _GUICtrlListView_GetItemTextString($idTestCaseList, $LoopCount) ExitLoop EndSwitch EndIf Return 1 EndFunc ;==>CheckError
      Problem is: i can't make this function (CheckError() ) return to main gui state, that means: break the If/ElseIf loop.
      The switch is working correctly (MsgBox on error shows only when it's activated).
      Checkerror() function works correctly - recognizes the error, stops script until decision is made. But it doesn't terminate If/ElseIf loop.

      Any help appreciated!
    • souldjer777
      By souldjer777
      Good Morning AutoIT Gurus and Masters
      Slightly complicated array here... and infinite loop that I'm trying to output to a file after the values are matched up; then anything that doesn't match is deleted from the array and finally written to a file...
      This guy does an infinite loop... and I'm not sure why... I tried to put in message boxes - but there are 20K records so I couldn't click through that many. LOL.
      #RequireAdmin #include <array.au3> #include <file.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Global $WXYZArray01, $array01, $ProgramTitle, $sleeptime, $k01 $ProgramTitle = "Testing 1 2 3" $sleeptime = 1000 _FileReadToArray(@ScriptDir & "\" & "testing_output_csv_unique_values.csv", $array01, "", ",") ;_ArrayDisplay ($array01, "Array01") $aUniqueHostname = _ArrayUnique ($array01, 1) ;_ArrayDisplay ($aUniqueHostname, "UniqueHostname ") For $i01 = Ubound($aUniqueHostname) - 1 to 0 Step - 1 For $j01 = Ubound($array01) - 1 to 0 Step - 1 If $array01[$j01][1] == $aUniqueHostname[$i01] and StringRegExp($array01[$j01][5], "MY_VALUE") then MsgBox(0, "Computer and MY_VALUE", $aUniqueHostname[$i01] & " : " & $array01[$j01][5]) $FileName01 = @ScriptDir & "\" & $array01[$j01][3] & "_" & $aUniqueHostname[$i01] & "_" & $array01[$j01][2] & ".csv" MsgBox(0, "File Name", $FileName01) $WXYZArray01 = $array01 _ArrayDisplay ($WXYZArray01, "WXYZ Array") SplashTextOn($ProgramTitle, 'Generic - Please wait for loop to complete...', 400, 40, -1, -1, 2, "", 10) Sleep ($sleeptime) For $k01 = 0 To Ubound($WXYZArray01) - 1 ; MsgBox (0, "In the WXYZ loop", $WXYZArray01[$k01][1] & " : " & $aUniqueHostname[$i01]) If $WXYZArray01[$k01][1] <> $aUniqueHostname[$i01] Then ;MsgBox (0, "In the WXYZ loop - Delete", $WXYZArray01[$k01][1] & " : " & $aUniqueHostname[$i01]) _ArrayDelete($WXYZArray01, $k01) ;_ArrayDisplay ($WXYZArray01) $k01 -= 1 EndIf If $k01 = UBound($WXYZArray01) - 1 Then ExitLoop Next SplashOff() MsgBox (0, "Out of the WXYZ loop", "Out of the WXYZ loop - File Write From Array") _FileWriteFromArray($FileName01, $WXYZArray01, 1) ExitLoop EndIf Next Next I'm hoping someone here can tell me why at a glance... I'm a little burned out to see the answer... feeling toasty LOL 
      Thank you everyone for your help!

       
    • ale1981
      By ale1981
      I might be doing this wrong but this seems to crash the GUI, what I want is to click the button, select something from the list view with a double click which populates the input box and delete's the GUI?
      #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <Misc.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 400, 400) $btn = GUICtrlCreateButton( "", 150, 50, 75, 20 ) $cInput = GUICtrlCreateInput( "", 10, 50, 100, 20 ) GUISetState() GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) Global $idListview While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn listpackers() EndSwitch WEnd Func listPackers() Global $packersGUI = GUICreate( "Packers List", 300, 300, -1, -1, $WS_SYSMENU ) $idListview = GUICtrlCreateListView( "", 2, 2, 294, 268 ) GUISetState( @SW_SHOW ) Local $packerList[2][2] = [[1, "Name1"],[2, "Name2"]] ; Add columns _GUICtrlListView_AddColumn( $idListview, "Packer ID", 75 ) _GUICtrlListView_AddColumn( $idListview, "Packer Name", 150 ) _GUICtrlListView_SetItemCount( $idListview, 3 ) _GUICtrlListView_AddArray( $idListview, $packerList ) _GUICtrlListView_DeleteItem( $idListview, 0 ) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2 $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $idListview Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) GUICtrlSetData( $cInput, _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index")) ) GUIDelete( $packersGUI ) Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
    • TrickyDeath
      By TrickyDeath
      Hello everyone,

      Have a tricky question:
       
      How i manage to exit from loop, but not from script?
      (ExitLoop it is ok, but runned out of ways, how to use it in my script )
       
      With this i have a problem:
      If i unpause (F2) the script, it will continue the loop.
      While scrip is paused (F2) i can restart it (F1), but:
      While script is paused (F2), and i open  my form (F3), and try to press button on it, it will not work, cause active loop is paused at background. (I hope i understand right the method)
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F1}", "RunScript") HotKeySet("{F2}", "Pause") HotKeySet("{F3}", "OpenForm") Global $Pause $GUI_Create_Form = GUICreate("Settings", 175, 95) $Button_Save = GUICtrlCreateButton("Save", 10, 60, 75, 25) $Button_Cancel = GUICtrlCreateButton("Cancel", 90, 60, 75, 25) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button_Save MsgBox(0, "Notification", "Settings have been saved!", 1) GUISetState(@SW_HIDE) Case $Button_Cancel GUISetState(@SW_HIDE) EndSwitch WEnd Func RunScript() Local $Numbers = 1 While 1 $Numbers = $Numbers + 1 Sleep(250) ToolTip("Numbers:" & $Numbers, 0, 0) WEnd EndFunc ;==>RunScript Func Pause() $Pause = Not $Pause While $Pause Sleep(100) ToolTip('Scrpit is "Paused"', 0, 0) WEnd ToolTip("", 0, 0) EndFunc ;==>Pause Func OpenForm() GUISetState() EndFunc ;==>OpenForm All i want is, brake the counter loop with hotkey.
      Can anyone help me to give a logical answare?
      (I do need the form with buttons, to store data / save settings)
    • jrumbaug
      By jrumbaug
      I created a GUI UDF() I called PickList() that returns the chosen value from the "pick list".

      Is there a prefered way to RETURN a value from the GUI and use GuiDelete() ?

      If I simply issue the GuiDelete() before RETURN, my return value is lost.

      OR

      Am I worring too much about using GUIDelte()?. The GUI does go away when the UDF is finished without using GuiDelete(), but I thought it is considered good form to call GuiDelete() at the end of a program to "clean up".


      thanks in advance.

      Jim Rumbaugh