Sign in to follow this  
Followers 0
youtuber

Array read & Delete edit box?

7 posts in this topic

#1 ·  Posted (edited)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$Form1 = GUICreate("Form1", 223, 283)
$Edit1 = GUICtrlCreateEdit("", 24, 24, 169, 161)
GUICtrlSetData(-1, "E1 " & @CRLF & "E2" & @CRLF & "E3")
$Button1 = GUICtrlCreateButton("Button1", 64, 224, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _arrayeditread()
    EndSwitch
WEnd

Func _arrayeditread()
Local $aEditread = StringSplit(GUICtrlRead($Edit1), @CR)
Local $var = $aEditread
For $a = 0 To UBound($var) -1
ConsoleWrite($var[$a] & @CR)
Sleep(200)
Next

For $a = 0 To UBound($var) -1
    _ArrayDelete($var[$a])
    Sleep(100)
    ConsoleWrite($var[$a] & @CR)
    Sleep(100)
Next
EndFunc

 

Edited by youtuber

Share this post


Link to post
Share on other sites



you want to delete the edit box content after you press the button?
use GUICtrlSetData($Edit1, "") instead of _ArrayDelete($var[$a])

Share this post


Link to post
Share on other sites

@youtuber it is great that you're finally including code in your posts. But a detailed description will also go a long way to getting the assistance you're after. That way, we don't have to waste time trying to guess at what you're doing, as jvds does above. Help us help you ;)

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

one by one delete an edit box 

Share this post


Link to post
Share on other sites

@youtuber: you mean something like this here?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$Form1 = GUICreate("Form1", 223, 283)
$Edit1 = GUICtrlCreateEdit("", 24, 24, 169, 161)
GUICtrlSetData(-1, "E1 " & @CRLF & "E2" & @CRLF & "E3")
$Button1 = GUICtrlCreateButton("Button1", 64, 224, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _arrayeditread()
    EndSwitch
WEnd

Func _arrayeditread()
    Local $aEditread = StringSplit(GUICtrlRead($Edit1), @LF)
    If @error Then Return
    GUICtrlSetData($Edit1, "")
    For $i = 2 To $aEditread[0]
        GUICtrlSetData($Edit1, StringStripCR($aEditread[$i]) & @CRLF, 1)
    Next
EndFunc

 

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@UEZ

yes that I want

To add to my edit box is that correct?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$Form1 = GUICreate("Form1", 223, 283)
$Edit1 = GUICtrlCreateEdit("", 24, 24, 169, 161)
GUICtrlSetData(-1, "E1 " & @CRLF & "E2" & @CRLF & "E3")
$Button1 = GUICtrlCreateButton("Button1", 64, 224, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _arrayeditread()
    EndSwitch
WEnd

Func _arrayeditread()
    local $var[4]
    $var[0] = "E4"
    $var[1] = "E5"
    $var[2] = "E6"
    $var[3] = "E7"

    Local $aEditread = StringSplit(GUICtrlRead($Edit1), @LF)
    If @error Then Return
    GUICtrlSetData($Edit1, "")
    For $i = 2 To $aEditread[0]
         Sleep(200)
        GUICtrlSetData($Edit1, StringStripCR($aEditread[$i]) & @CRLF, 1)
    Next
For $a = 0 To UBound($var) -1
    GUICtrlSetData($Edit1, StringStripCR($var[$a]) & @CRLF, 1)
    Sleep(200)
    Next
EndFunc

 

Share this post


Link to post
Share on other sites
Quote

To add to my edit box is that correct?

to add what to your edit box? the $var array?
it is hard to understand what you want to achieve, you need to explain in detail, and use the name of the items you want to talk about, example your array is called  $var, what do you want to do with it?
write at-least 3 or 4 lines of text trying to explain, we will help much faster that way
what about this code?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$Form1 = GUICreate("Form1", 223, 283)
$Edit1 = GUICtrlCreateEdit("", 24, 24, 169, 161)
GUICtrlSetData(-1, "E1 " & @CRLF & "E2" & @CRLF & "E3")
$Button1 = GUICtrlCreateButton("Button1", 64, 224, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _arrayeditread()
    EndSwitch
WEnd

Func _arrayeditread()
    local $var[4]
    $var[0] = "E4"
    $var[1] = "E5"
    $var[2] = "E6"
    $var[3] = "E7"

;~     Local $aEditread = StringSplit(GUICtrlRead($Edit1), @CRLF,1)
;~     If @error Then Return
;~     GUICtrlSetData($Edit1, "")
;~     For $i = 2 To $aEditread[0]
;~          Sleep(200)
;~         GUICtrlSetData($Edit1, StringStripCR($aEditread[$i]) & @CRLF, 1)
;~     Next
;~
;~  For $a = 0 To UBound($var) -1
;~      GUICtrlSetData($Edit1, StringStripCR($var[$a]) & @CRLF, 1)
;~      Sleep(200)
;~  Next

    ;read edit box string
    Local $aEditread = GUICtrlRead($Edit1)
    ConsoleWrite ('!-----Editread-----'&@lf&$aEditread&@lf&'!------------------'&@lf)

    ;convert $var array to string and use @CRLF between the strings of data to make it compatible with the main $Edit1 string
    $ReadVar = _ArrayToString($var,@CRLF)
    ConsoleWrite ('>-----$ReadVar-----'&@lf&$ReadVar&@lf&'>------------------'&@lf)

    ;add the old string and new string togheter also with the @CRLF between the strings
    $aEditread_ReadVar = $aEditread & @CRLF & $ReadVar

    ;Write $aEditread_ReadVar string to Edit1 box
    GUICtrlSetData($Edit1, $aEditread_ReadVar)

EndFunc

 

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