Jump to content
Sign in to follow this  
FinalVersion

Clear A Input Box

Recommended Posts

FinalVersion

#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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
martin

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

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.