CyBoRgWaR

Clearing value of a Input box and return/reset value of default.

11 posts in this topic

Hi , 

Need help in Clearing value of a particular Input box , then reset to default value of the input box during button clicks.

$Inputbox1 = GUICtrlCreateInput("test", 64, 280, 57, 21); where i have created 

Case $msg = $Button4 ; Task Disable ;  mapped to button 4
GUISetState()
GUICtrlSetState($Radio7, $GUI_DISABLE) ; this works fine
GUICtrlSetState($Radio7, $GUI_UNCHECKED);this works fine

GUICtrlSetState($inputbox1,$GUI_DISABLE) ;this works fine
GUICtrlSetState($inputbox 1,Default) ;  unable to clear the last entered value to default value (test)

Please help me out guys,

Share this post


Link to post
Share on other sites



CyBoRgWaR,

You need GUICtrlSetData to set the content of the input.

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

Let me try it bro .

 

Share this post


Link to post
Share on other sites

GUICtrlSetData($input box1 , default )

 

which clears the value and set it as "default" rather "test"

 

you mean to say i need to enter the value "test " again ? on the place of default?

 

Share this post


Link to post
Share on other sites

if i do so like 

 

GUICtrlSetData($inputbox1,"test")

 

then when ever i click the box its not clearing the inputbox rather it adds testtesttest and so on...

Share this post


Link to post
Share on other sites

CyBoRgWaR,

Indeed you need to define the content - how do you expect AutoIt to know what you set as the original value? And this works fine for me:

#include <GUIConstantsEx.au3>

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

$Inputbox1 = GUICtrlCreateInput("test", 64, 280, 57, 21)
$Button4 = GUICtrlCreateButton("Reset", 10, 450, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button4
            GUICtrlSetState($inputbox1,$GUI_DISABLE)
            GUICtrlSetData($inputbox1, "test")
    EndSwitch

WEnd

You might be interested in _GUICtrlEdit_SetCueBanner - that does automatically reset when the control is emptied.

M23

1 person likes this

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

Works like charm .... Thanks for your time and Help Bro , 

Share this post


Link to post
Share on other sites

also one more help ,

i have a group of inputbox, on one click all the inputbox need to be reset , so i need to make one by one or a single command can be done ??

 

example:

#include <GUIConstantsEx.au3>

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

$Inputbox1 = GUICtrlCreateInput("test", 64, 280, 57, 21)
$Button4 = GUICtrlCreateButton("Reset", 10, 450, 80, 30)
$Button3 = GUICtrlCreateButton("enable", 100, 450, 80, 30)
GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button4
            GUICtrlSetState($inputbox1,$GUI_DISABLE)
            GUICtrlSetState($inputbox2,$GUI_DISABLE)
            ;.
            ;.
            ;.
            ;.
            ;.
            ;.
            GUICtrlSetState($inputbox99,$GUI_DISABLE)
            
            
            GUICtrlSetData($inputbox1, "test")
            GUICtrlSetData($inputbox2, "test2")
            ;.
            ;.
            ;.
            ;.
            ;.
            ;.
            GUICtrlSetData($inputbox99, "test99")
            
            Case $Button3
            GUICtrlSetState($inputbox1,$GUI_enable); for entering manual values
            GUICtrlSetState($inputbox2,$GUI_enable)
            ;.
            ;.
            ;.
            ;.
            ;.
            ;.
            GUICtrlSetState($inputbox99,$GUI_enable)
            
            
            
            
            
    EndSwitch

WEnd

Is that any way i can do all at once without this bulk coding ??

Share this post


Link to post
Share on other sites

CyBoRgWaR,

Put the ControlIDs of the Inputs into an array and then loop through it like this:

#include <GUIConstantsEx.au3>

Global $aInput_CID[5]

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

For $i = 0 To UBound($aInput_CID) - 1
    $aInput_CID[$i] = GUICtrlCreateInput("Test " & $i, 10, 10 + (30 * $i), 50, 20)
Next
$Button4 = GUICtrlCreateButton("Reset", 10, 450, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button4
            For $i = 0 To UBound($aInput_CID) - 1
                GUICtrlSetState($aInput_CID[$i], $GUI_DISABLE)
                GUICtrlSetData($aInput_CID[$i], "Test " & $i)
            Next
    EndSwitch

WEnd

M23

1 person likes this

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

#10 ·  Posted

Cool bro , 

 

thank you so much...

Share this post


Link to post
Share on other sites

#11 ·  Posted

CyBoRgWaR,

My pleasure- as always.

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