Jump to content

Clearing a GuiCtrlEdit


Lej
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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

GUICtrlSetData($TextBox,"")

;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 :/

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

@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 ... ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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