 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
planetthoughtful
Joined: 22 Feb 2006 Posts: 24
|
Posted: Sun Mar 05, 2006 3:39 pm Post subject: Clearing an edit box? |
|
|
Hello All,
As per other posts, I'm new to GUI design in AutoHotkey. I'm wondering if anyone can tell me how I clear the contents of an edit box?
I've tried the following, but it doesn't seem to work:
GuiControl,,Subject,
Where 'Subject' is the name of the control...
Is there some other syntax that will let me clear an edit box in an AutoHotkey Gui?
Much warmth,
planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5382 Location: /b/
|
Posted: Sun Mar 05, 2006 4:08 pm Post subject: |
|
|
Are you sure the control has the variable name 'Subject'? e.g. Gui, Add, Edit, vSubject
The method you're using appears to be valid so I cannot find a reason for why it's not working. Try the following to see if it works: | Code: | Gui, Add, Edit, vSubject Multi r5 w400, this is some text
Gui, Add, Button, gClear, Clear Text
Gui, Show
Return
Clear:
GuiControl, , Subject
Return
GuiClose:
ExitApp |
_________________
 |
|
| Back to top |
|
 |
skwire
Joined: 18 Jan 2006 Posts: 172 Location: Conway, Arkansas
|
Posted: Mon Mar 06, 2006 5:22 am Post subject: |
|
|
I clear edit boxes using ControlSetText and the default control names:
| Code: | ControlSetText, Edit1,
ControlSetText, Edit2,
ControlSetText, Edit3, |
et al...
You can easily use an array to blank out a bunch of them:
| Code: | EditBoxes = Edit1|Edit2|Edit3|Edit4|Edit5|Edit6|Edit7
StringSplit, EditBoxes_Array, EditBoxes, |
Loop, %EditBoxes_Array0%
{
GetEditBoxName := EditBoxes_Array%a_index%
ControlSetText, %GetEditBoxName%,
} |
|
|
| Back to top |
|
 |
yellowsix
Joined: 17 Nov 2006 Posts: 6
|
Posted: Thu Apr 05, 2007 5:34 pm Post subject: |
|
|
I discovered that GuiControl will somehow only work on the default gui.
So if you have multiple gui windows, you should do something like:
Gui,1:Default
GuiControl,,Subject,
Gui,2:Default
Maybe this thing is 'fixed' in a newer version then mine.
Yellowsix |
|
| Back to top |
|
 |
sugardaddy
Joined: 05 Aug 2006 Posts: 26
|
Posted: Tue May 29, 2007 11:11 pm Post subject: |
|
|
| Code: | | GuiControl, 2:, FRMtextBox, %strOut% |
This works, but it appends to what's there. I'm still trying to find out how to clear it and then fill it. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2733 Location: Australia, Qld
|
Posted: Tue May 29, 2007 11:31 pm Post subject: |
|
|
| sugardaddy wrote: | | Code: | | GuiControl, 2:, FRMtextBox, %strOut% |
This works, but it appends to what's there. I'm still trying to find out how to clear it and then fill it. | Are you sure you aren't appending to strOut? If I try: | Code: | | GuiControl, 1:, MyEdit, %foo% | it replaces the existing text. |
|
| Back to top |
|
 |
sugardaddy
Joined: 05 Aug 2006 Posts: 26
|
Posted: Tue May 29, 2007 11:42 pm Post subject: |
|
|
After further review, it was other code that was the issue.
It is, in fact, replacing what is there. So I no longer have an issue. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|