Jump to content
Sign in to follow this  
DarkwarlorD

GUI Problems

Recommended Posts

DarkwarlorD

I researched the forum, could solve some problems, but one still exists:

when I click on the third button, it works, but only once. Who knows what's wrong?

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=I:\AutoIt 3.2\Icons\iconspack\tux.ico

#AutoIt3Wrapper_outfile=Down_Loader.exe

#AutoIt3Wrapper_Compression=4

#AutoIt3Wrapper_Res_Comment=Gerenciador de Gerenciadores de Download

#AutoIt3Wrapper_Res_Description=Down_Loader 1.0

#AutoIt3Wrapper_Res_Fileversion=1.0.0.0

#AutoIt3Wrapper_Res_LegalCopyright=© 2008 | -=|DarklorD|=-

#AutoIt3Wrapper_Res_Language=1033

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstants.au3>

#include <Misc.au3>

#NoTrayIcon

_Singleton("Down_Loader")

Global $folder = @ScriptDir & "\Gerenciador"

Global $Open_Form = False

Opt("GUIOnEventMode", 1)

#Region ### START Koda GUI section ###

Global $Main = GUICreate("Gerenciadores de Download", 383, 288, 285, 147)

GUISetIcon($folder&"\unlock.ico")

Global $Rapid = GUICtrlCreateButton("", 87, 56, 36, 36, 0)

GUICtrlSetOnEvent($Rapid, "RG")

Global $RH = GUICtrlCreateButton("", 87, 104, 36, 36, 0)

GUICtrlSetOnEvent($RH, "RH")

Global $TXT = GUICtrlCreateButton("", 87, 151, 36, 36, 0)

GUICtrlSetOnEvent($TXT, "Editar")

Global $Sair = GUICtrlCreateButton("Sair", 288, 248, 75, 25, 0)

GUICtrlSetOnEvent($Sair, "Sair")

Global $Autor = GUICtrlCreateLabel("Desenvolvido por -=|DarklorD|=-", 8, 264, 154, 17)

Global $Label1 = GUICtrlCreateLabel("Selecione o Gerenciador:", 71, 16, 222, 22)

GUICtrlSetFont(-1, 12, 800, 0, "Verdana")

Global $Label2 = GUICtrlCreateLabel("RapidGet", 159, 63, 73, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

Global $Label4 = GUICtrlCreateLabel("Rapid Hacker 3.7", 159, 112, 112, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

Global $Label5 = GUICtrlCreateLabel("Abrir Lista.txt", 159, 159, 127, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

GUISetOnEvent($GUI_EVENT_CLOSE, "Sair")

GUISetState(@SW_SHOW, $Main)

#EndRegion ### END Koda GUI section ###

While 1

Sleep(20)

If $Open_Form = True Then

Open_Form()

EndIf

WEnd

Func Editar()

$Open_Form = True

EndFunc

Func Open_Form()

Global $Form = GUICreate("Editar Lista.txt", 378, 215, 193, 125)

GUISetOnEvent($GUI_EVENT_CLOSE, "Fechar")

Global $Edit = GUICtrlCreateEdit("", 8, 8, 361, 169)

GUICtrlSetData(-1, "Edit")

Global $Salvar = GUICtrlCreateButton("Salvar Lista",104, 184, 161, 25, 0)

GUICtrlSetOnEvent($Salvar, "Salvar")

GUISwitch($Form)

GUISetState(@SW_SHOW)

Global $file = FileOpenDialog("Selecione a Lista.txt", @ScriptDir , "Lista (Lista.txt)", 1, 'Lista.txt' )

If @error Then

MsgBox(0, "Erro", "FileOpenDialog error")

Exit

EndIf

Global $FileData = FileRead( $file )

GUICtrlSetData( $Edit, $FileData )

While 1

Sleep(100)

WEnd

EndFunc

Func RG()

Run($folder&"\RG.exe")

EndFunc

Func RH()

Run($folder&"\RH.exe")

EndFunc

Func USD()

Run($folder&"\USD.exe")

EndFunc

Func Sair()

MsgBox(0, "Sair", "Você solicitou o fechamento da Janela Principal! Saindo...")

Exit

EndFunc

Func Fechar()

MsgBox(0, "Sair", "Você solicitou o fechamento da Janela Editar Lista.txt! Saindo...")

GUIDelete()

$Open_Form = False

GUISwitch($Main)

EndFunc

Func Salvar()

FileDelete( $file )

FileWrite( $file, GUICtrlRead( $Edit ))

MsgBox(0, "Lista.txt", "Alterações Salvas." & @CRLF & "Click em OK para Continuar.")

$FileData = FileRead( $file )

GUICtrlSetData( $Edit, $FileData )

EndFunc

Thank you for your attention and I apologize for the error, I am not fluent in English.

Share this post


Link to post
Share on other sites
DjDeep00

@DarkwarlorD...The reason why nothing happens when u click the button the second time is because you did not exit the second while loop in Open_Form().

While 1
Sleep(100)
WEnd

Share this post


Link to post
Share on other sites
DarkwarlorD

Thanks for tip, but have some idea of how I fix it ... I am a newbie.

I know that I'll have to see if the Close button was clicked and then break the looping, but I do not know implement.

Could you help me, please?

Share this post


Link to post
Share on other sites
DjDeep00

While 1
Sleep(100)
If @GUI_CtrlId = $GUI_EVENT_CLOSE then ExitLoop
WEnd

;)

Share this post


Link to post
Share on other sites
DarkwarlorD

That's great... it works very fine!!!

Thank you for help me. ;)

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
Sign in to follow this  

×