Jump to content

Array read & Delete edit box?


Recommended Posts

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

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

 

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

 

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