Sign in to follow this  
Followers 0
Lej

Clearing a GuiCtrlEdit

7 posts in this topic

#1 ·  Posted (edited)

So I have a simple GUI with a Edit.

I add some lines to it with a loop

For $y = 0 to 3 Step 1
        For $x = 0 to 3 Step 1
            GUICtrlSetData($TextBox, GUICtrlRead($TextBox) & @CRLF & $x & "," & $y)
        Next
    Next

Works fine. Creates something like this:

0,0
1,0
2,0
3,0
0,1
1,1
2,1
3,1
0,2
1,2
2,2
3,2
0,3
1,3
2,3
3,3

Now how do I go about clearing the editbox of all text in it?

Edited by Lej

Share this post


Link to post
Share on other sites



GUICtrlSetData($TextBox, "")

Share this post


Link to post
Share on other sites

Thanks! Stupid me had entered " " instead of "".

Another question if you don't mind. How to split the text in $TextBox so I get an array with one line per element. I tried

$lines = StringSplit(GUICtrlRead($TextBox), '\n')

But it doesn't seem to be working :/

Share this post


Link to post
Share on other sites

Thanks! Stupid me had entered " " instead of "".

Another question if you don't mind. How to split the text in $TextBox so I get an array with one line per element. I tried

$lines = StringSplit(GUICtrlRead($TextBox), '\n')

But it doesn't seem to be working :/

replace "\n" with @LF

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@JdeB : doesn't CR and LF in editboxes only display does little square boxes,

meaning you have to use CRLF instead ? Also, then the third parameter for

StringSplit would have to be set to 1. Something like this then I believe :

$lines = StringSplit(GUICtrlRead($edit), @CRLF, 1)

Share this post


Link to post
Share on other sites

@JdeB : doesn't CR and LF in editboxes only display does little square boxes,

meaning you have to use CRLF instead ? Also, then the third parameter for

StringSplit would have to be set to 1. Something like this then I believe :

$lines = StringSplit(GUICtrlRead($edit), @CRLF, 1)
You could be right ... i never know and always need to test ..

But the SpringSplit() will work, you will only end up with an @cr at the end of each entry .

I always assume the OP has some knowledge and can sort these things out themselves ... ;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  
Followers 0