Jump to content

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


Recommended Posts

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,

Link to comment
Share on other sites

  • Moderators

CyBoRgWaR,

You need GUICtrlSetData to set the content of the input.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

CyBoRgWaR,

My pleasure- as always.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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