TheSovereign Posted May 27, 2009 Share Posted May 27, 2009 Howdy, I've been a longtime lurker as well as a learner from these forums -- thank you for all your helpful contributions and insights. =) Anyway, the time has come where I am stumped by an issue and have been forced to register in order to post a question; I am sure the answer is quite simple, but I haven't been able to find the answer in my searches of the forum. I am trying to automatically populate an inputbox ($Input2) with the data from the previous inputbox ($Input1), yet I would still like it to be able to manually edit the data ($Input2). With the code I have, $Input2 is always the same as $Input1; I understand why, but I don't understand how to modify this behavior. I'm thinking I need some If/Then statements, but not sure how/where they need to be placed. Hope someone can give me a hand with this... Thank you in advance. Here is the code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Display1 = "" $Form1 = GUICreate("Form1", 250, 200, @DesktopWidth/2-250/2, @DesktopHeight/2-200/2) $Input1 = GUICtrlCreateInput("", 15, 18, 220, 21) $Input2 = GUICtrlCreateInput("", 15, 50, 220, 21) $Button1 = GUICtrlCreateButton ("Field Values",15,150,220,21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0,"Field Values","Input 1: " & GUICtrlRead($Input1) & @CRLF & "Input 2: " & GUICtrlRead($Input2)) Case GUICtrlRead($Input1) <> $Display1 $Display1 = GUICtrlRead($Input1) GUICtrlSetData($Input2,$Display1) EndSwitch WEnd [font="Courier New"]__________________________________________________There is always another way, usually a better one.[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2009 Moderators Share Posted May 27, 2009 TheSovereign, Welcome to the AutoIt forums, Your Majesty....(bowing and scraping furiously) :-) Your humble servitor begs leave to inform you that you were very nearly there:#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Display1 = "" $Form1 = GUICreate("Form1", 250, 200, @DesktopWidth/2-250/2, @DesktopHeight/2-200/2) $Input1 = GUICtrlCreateInput("", 15, 18, 220, 21) $Input2 = GUICtrlCreateInput("", 15, 50, 220, 21) $Button1 = GUICtrlCreateButton ("Field Values",15,150,220,21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0,"Field Values","Input 1: " & GUICtrlRead($Input1) & @CRLF & "Input 2: " & GUICtrlRead($Input2)) EndSwitch If GUICtrlRead($Input1) <> $Display1 Then $Display1 = GUICtrlRead($Input1) GUICtrlSetData($Input2,$Display1) Endif WEnd I have the honour to remain Your Majesty's most obedient servant. :-D M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheSovereign Posted May 27, 2009 Author Share Posted May 27, 2009 Wow, that's great! Thank you very much for your help, and for the fast reply!!! I've been racking my brains on this one for the past day, trying all kinds of combinations and variations... except that one! And please, dispense with the formalities. It is I who am humbled by your mastery of AutoIt! =) [font="Courier New"]__________________________________________________There is always another way, usually a better one.[/font] Link to comment Share on other sites More sharing options...
nanyi0509 Posted May 28, 2009 Share Posted May 28, 2009 #NoTrayIcon #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 295, 175, 192, 124) $Input1 = GUICtrlCreateInput("", 64, 32, 177, 21) $Input2 = GUICtrlCreateInput("", 62, 77, 177, 21) $Button1 = GUICtrlCreateButton("Field Values", 104, 112, 81, 33, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0,"Field Values","Input 1:"& GUICtrlRead($Input1) & @CRLF & "Input 2: " & GUICtrlRead($Input2)) EndSwitch If GUICtrlRead($Input1)<>"" Then GUICtrlSetData($Input2,GUICtrlRead($Input1)) WEnd Link to comment Share on other sites More sharing options...
TheSovereign Posted May 28, 2009 Author Share Posted May 28, 2009 nanyi0509, that code does not work for me, I am unable to edit the data for $Input2... BTW, M23's code works perfectly. [font="Courier New"]__________________________________________________There is always another way, usually a better one.[/font] 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