blumi Posted February 3, 2011 Share Posted February 3, 2011 I have a GUI with two Textboxes. In the first I want to insert a text, by clicking on a button I want to read the textbox1, edit the string and then write it into the second textbox of the GUI. Read textbox1 -> not problem Edit the string from textbox1 -> no problem Insert the new text into the second textbox -> problem Hot to realize this? Thanks Link to comment Share on other sites More sharing options...
funkey Posted February 3, 2011 Share Posted February 3, 2011 Have you tried 'GuiCtrlSetData'? It would be easier to help you when you post a small script, that we can see what you are making wrong. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
blumi Posted February 3, 2011 Author Share Posted February 3, 2011 Have you tried 'GuiCtrlSetData'? It would be easier to help you when you post a small script, that we can see what you are making wrong. expandcollapse popup#include <GUIConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #include <GUITab.au3> ; Config $ScriptName = "TestScript" $breite = 400 $hoehe = 350 $icon = "logo.ico" $ButtonBreite1 = 150 $ButtonHoehe1 = 30 $author = "© Frank" $version = "Version 1.0" ; GUI - Breite und Höhe des Fensters GuiCreate($ScriptName, $breite, $hoehe) ; Textbox 1 GUICtrlCreateLabel ("Textbox1", 10, 25) $input1 = GUICtrlCreateInput ("Hier der Text zum editieren", 40, 40, 250, 100) GUICtrlSetTip (-1, "TEST") ; Textbox 2 GUICtrlCreateLabel ("Textbox2", 10, 145) $input2 = GUICtrlCreateInput ("", 40, 160, 250, 100) GUICtrlSetTip (-1, "TEST") $ButtonLos = GuiCtrlCreateButton("&Los", ($breite/3)-($ButtonBreite1/2), $hoehe-60, 100, 30) GUICtrlSetTip(-1, "Text ändern") $ButtonExit = GuiCtrlCreateButton("&Ende", (($breite/3)+($breite/3)-($ButtonBreite1/2)), $hoehe-60, 100, 30) GUICtrlSetTip(-1, "Programm beenden") ; Copyright GUISetFont (8, 400, 0, 0) GUICtrlCreateLabel ($author, 10, $hoehe - 20) GUICtrlCreateLabel ($version, $breite-60, $hoehe - 20) ; Show the GUI GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $ButtonLos BearbeiteText() Case $msg = $GUI_EVENT_CLOSE Or $msg = $ButtonExit GUIDelete() Exit EndSelect WEnd ; Funktion zum Text bearbeiten und ausgeben Func BearbeiteText() $test = GUICtrlRead($input1) ;MsgBox(64, $ScriptName, $test) $test = $test & "12345" $test = $test & @LF & "67890" $input2 = GUICtrlCreateInput ($test, 40, 160, 250, 100) ;MsgBox(64, $ScriptName, $test) EndFunc Link to comment Share on other sites More sharing options...
funkey Posted February 3, 2011 Share Posted February 3, 2011 Use Edit instead of Input and do not create a new input instead of updating the old one. expandcollapse popup#include <GUIConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #include <GUITab.au3> ; Config $ScriptName = "TestScript" $breite = 400 $hoehe = 350 $icon = "logo.ico" $ButtonBreite1 = 150 $ButtonHoehe1 = 30 $author = "© Frank" $version = "Version 1.0" ; GUI - Breite und Höhe des Fensters GUICreate($ScriptName, $breite, $hoehe) ; Textbox 1 GUICtrlCreateLabel("Textbox1", 10, 25) $input1 = GUICtrlCreateEdit("Hier der Text zum editieren", 40, 40, 250, 100, BitOR(0x40, 0x80)) GUICtrlSetTip(-1, "TEST") ; Textbox 2 GUICtrlCreateLabel("Textbox2", 10, 145) $input2 = GUICtrlCreateEdit("", 40, 160, 250, 100, BitOR(0x40, 0x80)) GUICtrlSetTip(-1, "TEST") $ButtonLos = GUICtrlCreateButton("&Los", ($breite / 3) - ($ButtonBreite1 / 2), $hoehe - 60, 100, 30) GUICtrlSetTip(-1, "Text ändern") $ButtonExit = GUICtrlCreateButton("&Ende", (($breite / 3) + ($breite / 3) - ($ButtonBreite1 / 2)), $hoehe - 60, 100, 30) GUICtrlSetTip(-1, "Programm beenden") ; Copyright GUISetFont(8, 400, 0, 0) GUICtrlCreateLabel($author, 10, $hoehe - 20) GUICtrlCreateLabel($version, $breite - 60, $hoehe - 20) ; Show the GUI GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $ButtonLos BearbeiteText() Case $msg = $GUI_EVENT_CLOSE Or $msg = $ButtonExit GUIDelete() Exit EndSelect WEnd ; Funktion zum Text bearbeiten und ausgeben Func BearbeiteText() $test = GUICtrlRead($input1) ;MsgBox(64, $ScriptName, $test) $test = $test & "12345" $test = $test & @CRLF & "67890" GUICtrlSetData($input2, $test) ;MsgBox(64, $ScriptName, $test) EndFunc ;==>BearbeiteText Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
blumi Posted February 3, 2011 Author Share Posted February 3, 2011 Okay, tried it, works fine, thanks a lot. Another question. Is there a way to use/show the @CRLF in the Textbox? It seems to be ignored. Link to comment Share on other sites More sharing options...
funkey Posted February 3, 2011 Share Posted February 3, 2011 Add the style $ES_WANTRETURN (0x1000) to the edit control. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
blumi Posted February 3, 2011 Author Share Posted February 3, 2011 Add the style $ES_WANTRETURN (0x1000) to the edit control. You mean something like this: ; Textbox 2 GUICtrlCreateLabel ("Textbox2", 10, 145) $input2 = GUICtrlCreateEdit ("", 40, 160, 250, 100, 0x1000) ;$input2 = GUICtrlCreateInput ("", 40, 160, 250, 100) GUICtrlSetTip (-1, "TEST") Link to comment Share on other sites More sharing options...
blumi Posted February 3, 2011 Author Share Posted February 3, 2011 I made it. ;-) ; Textbox 2 GUICtrlCreateLabel ("Textbox2", 10, 145) $input2 = GUICtrlCreateEdit ("", 40, 160, 250, 100, $ES_WANTRETURN) GUICtrlSetTip (-1, "TEST") Link to comment Share on other sites More sharing options...
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