yellowpower Posted November 27, 2010 Posted November 27, 2010 I have created a GUI with two Edit and one button, when the button is pressed, I would like to have my code start reading the data in one Edit and write data into another Edit. Is this possible? Could someone show me the syntax for reading and writing data onto Edit? Thanks
JoHanatCent Posted November 27, 2010 Posted November 27, 2010 Post your code. Will be a lot easier to help! Unless you never tried the help that comes with AutoIt!
yellowpower Posted November 27, 2010 Author Posted November 27, 2010 Post your code. Will be a lot easier to help! Unless you never tried the help that comes with AutoIt!
yellowpower Posted November 27, 2010 Author Posted November 27, 2010 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $Form1 = GUICreate("CodeConverter", 625, 443, 261, 124) $Edit1 = GUICtrlCreateEdit("", 120, 16, 425, 169) GUICtrlSetData(-1, "Source") $Edit2 = GUICtrlCreateEdit("", 120, 208, 425, 185) GUICtrlSetData(-1, "Ouput") $Button1 = GUICtrlCreateButton("Generate", 16, 16, 89, 25, $WS_GROUP) GUICtrlSetOnEvent($Button1, "CodeConverting") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(1000) ; Idle around WEnd Func CodeConverting() ;code to read data in Edit1 and write data on Edit2 EndFunc Func CLOSEClicked() Exit EndFunc
C45Y Posted November 27, 2010 Posted November 27, 2010 (edited) EDIT: Nevermind cant delete post for some reason... Edited November 27, 2010 by C45Y http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun
SadBunny Posted November 27, 2010 Posted November 27, 2010 GuiCtrlRead() on the first edit will give you the contents of the first edit. GuiCtrlSetData() can be used to push those contents into the second edit. #include <GUIConstantsEx.au3> GUICreate("test", 500, 200) $input1 = GUICtrlCreateInput("This is edit 1", 10, 10, 450, 20) $input2 = GUICtrlCreateInput("... edit 2 ...", 10, 40, 450, 20) $button = GUICtrlCreateButton("Copy contents of edit1 into edit2", 10, 80, 450, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg == $GUI_EVENT_CLOSE Then Exit If $msg == $button Then $contentOfInput1 = GUICtrlRead($input1) GUICtrlSetData($input2, $contentOfInput1) EndIf Sleep(10) WEnd Roses are FF0000, violets are 0000FF... All my base are belong to you.
yellowpower Posted November 27, 2010 Author Posted November 27, 2010 GuiCtrlRead() on the first edit will give you the contents of the first edit. GuiCtrlSetData() can be used to push those contents into the second edit. #include <GUIConstantsEx.au3> GUICreate("test", 500, 200) $input1 = GUICtrlCreateInput("This is edit 1", 10, 10, 450, 20) $input2 = GUICtrlCreateInput("... edit 2 ...", 10, 40, 450, 20) $button = GUICtrlCreateButton("Copy contents of edit1 into edit2", 10, 80, 450, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg == $GUI_EVENT_CLOSE Then Exit If $msg == $button Then $contentOfInput1 = GUICtrlRead($input1) GUICtrlSetData($input2, $contentOfInput1) EndIf Sleep(10) WEnd Thanks!!!
SadBunny Posted November 27, 2010 Posted November 27, 2010 Thanks!!!You're very welcome, glad I could help. Roses are FF0000, violets are 0000FF... All my base are belong to you.
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