Jump to content
Sign in to follow this  

HELP How to make a clear button that can clear my "Input"

Recommended Posts


Hi all, well i making a little "DB" to my brother, for the clients that he have and make them all in a INI file.

I manage to make the GUI now, its a "trail" one but im trying to make it work first.

How can i make my CLEAR button to delete all the info that are in the INPUT BOX's?!?!

#cs ----------------------------------------------------------------------------

  Author:         rAsOOl

 Script Function:
    Template AutoIt script.

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

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
Dim $Version = "1"
Dim $Start = 0

$GUI = GUICreate("Base de Contactos BES V1", 633, 454)

$Procura = GUICtrlCreateButton("Procura", 152, 16, 75, 25)
$Novo_Registo = GUICtrlCreateButton("Novo_Registo", 152, 56, 75, 25)
$Depositos = GUICtrlCreateButton("Depositos", 144, 168, 75, 25)
$Gravar = GUICtrlCreateButton("Gravar", 144, 198, 75, 25)
$Clear = GUICtrlCreateButton("Clear", 544, 16, 75, 25)

$InputN_Adesao = GUICtrlCreateInput("N_Adesao", 16, 16, 121, 21)
$InputNome = GUICtrlCreateInput("Nome", 312, 32, 121, 21)
$InputContacto = GUICtrlCreateInput("Contacto", 320, 64, 121, 21)
$InputEmail = GUICtrlCreateInput("Email", 312, 104, 121, 21)

$LabelNome = GUICtrlCreateLabel("Nome", 272, 24, 32, 17)
$LabelContacto = GUICtrlCreateLabel("Contacto", 264, 64, 47, 17)
$LabelEMail = GUICtrlCreateLabel("EMail", 272, 96, 30, 17)

$Group1 = GUICtrlCreateGroup("Group1", 248, 8, 241, 161)

GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
        Case $Gravar
        Case $Clear

Func _Check4CLOSEClicked();Exit
$answer = MsgBox(36, "Wanning", "Are you sure?", 8 )
If $answer = 6 Then

Func _Check4Clear()
;========> HERE IS where i whant to make the programe to Clear all Inputs  <==========

Func _Check4Gravar()
    IniWrite ( "Base de Contactos BES.ini", GUICtrlRead($InputN_Adesao) , "Nome" , GUICtrlRead($InputNome))
    IniWrite ( "Base de Contactos BES.ini", GUICtrlRead($InputN_Adesao) , "Contacto" , GUICtrlRead($InputContacto))
    IniWrite ( "Base de Contactos BES.ini", GUICtrlRead($InputN_Adesao) , "Email" , GUICtrlRead($InputEmail))

Thx for all the help you can give me...

My next step is to make a "check button and reload all info on the INI file to the GUI".

The button to make it work is called "PROCURAR (Shearch)", if data exists, it loads all the info to the input parts.

How can i make it ???

Thx one more time ppl.

Edited by mini

Share this post

Link to post
Share on other sites

Since your creation of the Gui is not in a func then gui delete and recreating the gui will not work.

GuiCtrlSetData can be used on all the controls to clear out contents.



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

The function you want is:

GuiCtrlSetData ($handle, "")
Iterate over all of your input fields with this and you should be good to go.

Edit: Dang Kaotkbliss, you beat me to it, good job :mellow:

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.