AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Clearing an edit box?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
planetthoughtful



Joined: 22 Feb 2006
Posts: 24

PostPosted: Sun Mar 05, 2006 3:39 pm    Post subject: Clearing an edit box? Reply with quote

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
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5382
Location: /b/

PostPosted: Sun Mar 05, 2006 4:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
skwire



Joined: 18 Jan 2006
Posts: 172
Location: Conway, Arkansas

PostPosted: Mon Mar 06, 2006 5:22 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
yellowsix



Joined: 17 Nov 2006
Posts: 6

PostPosted: Thu Apr 05, 2007 5:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
sugardaddy



Joined: 05 Aug 2006
Posts: 26

PostPosted: Tue May 29, 2007 11:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2733
Location: Australia, Qld

PostPosted: Tue May 29, 2007 11:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
sugardaddy



Joined: 05 Aug 2006
Posts: 26

PostPosted: Tue May 29, 2007 11:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group