Jump to content

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

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

;Buttons
$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)

;Input
$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)

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

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

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

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            _Check4CLOSEClicked()
        Case $Gravar
            _Check4Gravar() 
        Case $Clear
            _Check4Clear()  
    EndSwitch
WEnd

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

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

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))
    
EndFunc

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
Link to comment
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.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
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!

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...