v0id Posted July 31, 2019 Posted July 31, 2019 No code, just question in general. Let's say we have Edit field $textarea = GUICtrlCreateEdit('', 100, 10, 200, 100) If I type the following into this edit field: test1 test2 I want for an array to contain test1 and test2 (so I could grab the values later). Obviously if I type 5 lines of text I want array to contain 5 entries etc etc. What is the best way to go about this?
FrancescoDiMuro Posted July 31, 2019 Posted July 31, 2019 1 minute ago, v0id said: What is the best way to go about this? GUICtrlRead() Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
v0id Posted July 31, 2019 Author Posted July 31, 2019 Thanks, and for those who need the code: #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Basic Template", 400, 300) $edit = GUICtrlCreateEdit("", 10, 80, 380, 140) $button = GUICtrlCreateButton("Press me!", 320, 260, 70, 25) GUICtrlSetOnEvent($button, "ButtonFunction") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func ButtonFunction() $data = GUICtrlRead($edit) $aArray = StringSplit($data, @CRLF, $STR_ENTIRESPLIT) For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i]) Next EndFunc Func ExitGui () Exit ; Exit the program EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now