Jump to content

Return to the previous GUI in a bucle of GUI`S


Delai
 Share

Recommended Posts

Hi men, i will explain what i want to do.

I want to made a loop of guis gui with three buttons, the button "back" should be greyed at the first time, i was be able to do it. the problem, i don´t know how to code when i click the buttion back, the gui return to the previous gui like if you will install a program, you click some options but after, you remember that you have clicked an option you don´t want, so you click the button 'back' to return to the previous GUI to change these options.

#include <GUIConstants.au3>
#include <File.au3>
$Path = _PathFull(@ScriptDir)
$search = FileFindFirstFile("*.txt")
If $search = -1 Then
  MsgBox(0, "Error", "No files/directories matched the search pattern")
  Exit
EndIf
$i_Disable = 1
While 1
    $File = FileFindNextFile($search)
    If @error Then ExitLoop
    $Nombre = StringSplit( $File , ". " )
    Button_Continue()
    $i_Disable = $i_Disable + 1
WEND
FileClose($search)

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Func Button_Continue()

    GUICreate("My GUI", 800, 340); will create a dialog box that when displayed is centered
    $Button_1 = GUICtrlCreateButton ("back",  220, 300, 60)
    GUICtrlSetFont (-1,"11","800","", "Comic Sans MS")   
    
    IF $i_Disable = 1   Then;---> Here it will disable the button "Back" at the first time 
      GUICtrlSetState(-1,$GUI_DISABLE)
    Else
    ENDIF
    
    $Button_2 = GUICtrlCreateButton ("I don´t want this file",  310, 300, 180)
    GUICtrlSetFont (-1,"11","800","", "Comic Sans MS")   

    $Button_3 = GUICtrlCreateButton ("Continue",  520, 300, 80)
    GUICtrlSetFont (-1,"11","800","", "Comic Sans MS")   

    GUICtrlCreateLabel ($File,  150, 10, 700, 60)
    GUICtrlSetFont (-1,"12","","", "Comic Sans MS")   
    GUICtrlSetColor(-1,0xff0000); Red
    GUISetState (); will display an  dialog box with 1 checkbox
    $Height=10
    For $i=1 to $Nombre[0]
      $Nombre[$i] = GUICtrlCreateRadio ($Nombre[$i], 10, $Height, 140, 20)
      $Height += 20
    Next

While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button_1
    ;-----> Here i want to do what i have explained above      
        Case $Button_2
          ExitLoop

        Case $Button_3
    ; This checks to to see which radio button is selected.
    ; If nothing is selected checked = 0, if something is
    ; selected then checked = the array element of the control.
        $checked = 0
        For $i = 1 To $Nombre[0]
        If GUICtrlRead($Nombre[$i]) = $GUI_CHECKED Then
           $checked = $i
           ExitLoop
         EndIf
        Next

        If $checked > 0 Then
           $Box= MsgBox(65, 'Archivo', 'Has Seleccionado El archivo: '  & GUICtrlRead($Nombre[$checked],1) & @CRLF & 'Si Te Gusta El nombre, Dale a Aceptar' & @CRLF & 'Sino, Dale a Cancelar y Elige Otro')

            IF $Box = 1 Then
              $Sample = ".\Scripts\Plantilla\Sample.txt"
              $Text_File = FileRead($Sample,FileGetSize($Sample))
              $Text_File = StringReplace($Text_File,"Titulo",$File)
              $Text_File = StringReplace($Text_File,"Plantilla",GUICtrlRead($Nombre[$checked],1))
              FileWrite("Texto.txt", $Text_File)
              ExitLoop
            ELSE
                        ENDIF
    
                                Else
           $MsgBox=MsgBox(0, 'Ningun archivo Seleccionado', 'Debes seleccionar un archivo')
         ENDIF

    EndSwitch
  WEnd
  GuiDelete()

EndFunc
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Exit

Thanks very much

Edited by Delai
Link to comment
Share on other sites

Is There anyone please who can help me, i have searched a lot, only i have found how to change a GUI with an other GUI, but inside a loop (to return back to the previuos GUI), i have not found it or i have not searched well.

Thanks very much

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...