mtmartis Posted December 17, 2015 Share Posted December 17, 2015 (edited) Can someone point me in the right direction on how to update a gui control that uses a previous control as a variable on the same form once it's modified?In the code , $var1 references a previous control, $input1.How can I get the $lbl3 control to update as soon as data has been entered in the $input1 control. I am thinking of somehow checking if the $input1 control is not active (either by clicking another control or tabbing off of it) then update the $lvb3 control.#include <GUIConstantsEx.au3> $Form = GUICreate("Form1", 275, 208, 192, 124) $lbl1 = GUICtrlCreateLabel("Enter Group Name", 40, 16, 92, 17) $input1 = GUICtrlCreateInput("Data Field", 40, 40, 121, 21) $cbox1 = GUICtrlCreateCheckbox("Is Allowed", 48, 80, 97, 17) $lbl2 = GUICtrlCreateLabel("File Name will be:", 40, 120, 100, 17) $var1 = GUICtrlRead($input1, $GUI_READ_EXTENDED) $lbl3 = GUICtrlCreateLabel($var1 & "_datafile.txt", 45, 140, 200, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited December 17, 2015 by mtmartis Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2015 Moderators Share Posted December 17, 2015 mtmartis,Look for the input content being changed and update the label accordingly:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> $Form = GUICreate("Form1", 275, 208, 192, 124) $lbl1 = GUICtrlCreateLabel("Enter Group Name", 40, 16, 92, 17) $input1 = GUICtrlCreateInput("Data Field", 40, 40, 121, 21) $cbox1 = GUICtrlCreateCheckbox("Is Allowed", 48, 80, 97, 17) $lbl2 = GUICtrlCreateLabel("File Name will be:", 40, 120, 100, 17) $var1 = GUICtrlRead($input1, $GUI_READ_EXTENDED) $lbl3 = GUICtrlCreateLabel($var1 & "_datafile.txt", 45, 140, 200, 33) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from our input If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $input1 Then ; Set the label to the new data GUICtrlSetData($lbl3, GUICtrlRead($input1)) EndIf EndFunc ;==>_WM_COMMANDIf you are not used to using GUIRegisterMsg, the GUIRegisterMsg tutorial in the Wiki will explain all about it.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...
mtmartis Posted December 17, 2015 Author Share Posted December 17, 2015 Hi Melba,I have never used GuiRegisterMsg before, I am digging into the help regarding it to learn what it does and how to use it. Thank you very much for your assistance!-M Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2015 Moderators Share Posted December 17, 2015 mtmartis,Do not hesitate to ask if you have any questions. I hope the tutorial to which I linked is clear, but it is a tricky subject...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...
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