Jump to content

Clear A Input Box


Recommended Posts

#include-once

Func _Reset()
    GUICtrlSetData($txtBufferSize, "")
EndFunc

Lets say I have a GUI with an input box(txtBufferSize), can I clear the data from a function in the included file? Also a function from the main au3 file (GUI), calls this within the functions.au3.

Edited by FinalVersion
Link to comment
Share on other sites

The native GuiCtrlSetData() does not require any include files to work, and will work fine in main line execution of the script or any called functions, as long as $txtBufferSize is equal to the integer Control ID and the control is in an AutoIt GUI created by the same script. If you are trying to operate on an outside GUI, use ControlSetText() to specify the window and control to operate on.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

#include-once

Func _Reset()
    GUICtrlSetData($txtBufferSize, "")
EndFunc

Lets say I have a GUI with an input box(txtBufferSize), can I clear the data from a function in the included file? Also a function from the main au3 file (GUI), calls this within the functions.au3.

Yes, assuming txtBufferSize is a global variable but that is not good practice because it means your include file is not 'general purpose' and can't be used in other scripts. Even in the same script you can't use the function for a different input so you would have to write another function to do exacly the same for a second input.

Much better to pass a parameter for the id or handle of the input.

Func ResetInput($iID)
 GUICtrlSetData($iID, "")
EndFunc

But of course I assume that this is not a real example because calling the function is not simpler than writing the code in the function.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...