notta Posted April 7, 2008 Share Posted April 7, 2008 (edited) I'm just curious how you guys would accomplish this? I have a GUI with about 10 input boxes and a submit button at the bottom. When the user clicks submit I check to make sure all the fields are not = "" and I also have an IP box that I check to make sure their inputting valid values. If any of the fields are blank or incorrect than I want to return them to the GUI. I need to show them what fields are causing the problem, but I'm not too sure what is the best way to go about this. I thought about putting a little red x image next to the input box that is incorrect, but I don't want to have to use multiple files. Having one .exe is most convenient thing for us. I also thought about putting "ERROR!! inside the input box, but if they miss ERROR!! that value will no longer be = "" and will submit ERROR!! for that value. How about changing the state to all the non error fields to GUI_DISABLE? Can I change the font color of the label of the offending boxes? How would you guys do it? Thanks. Edited April 7, 2008 by notta Link to comment Share on other sites More sharing options...
martin Posted April 7, 2008 Share Posted April 7, 2008 I'm just curious how you guys would accomplish this? I have a GUI with about 10 input boxes and a submit button at the bottom. When the user clicks submit I check to make sure all the fields are not = "" and I also have an IP box that I check to make sure their inputting valid values. If any of the fields are blank or incorrect than I want to return them to the GUI. I need to show them what fields are causing the problem, but I'm not too sure what is the best way to go about this. I thought about putting a little red x image next to the input box that is incorrect, but I don't want to have to use multiple files. Having one .exe is most convenient thing for us. I also thought about putting "ERROR!! inside the input box, but if they miss ERROR!! that value will no longer be = "" and will submit ERROR!! for that value. How about changing the state to all the non error fields to GUI_DISABLE? Can I change the font color of the label of the offending boxes? How would you guys do it? Thanks. Here's on eway. expandcollapse popup#include <guiEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> ;AdlibEnable("highlightIP", 400) Dim $IPList[3];the inputs GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $gui = GUICreate("My GUI edit"); will create a dialog box that when displayed is centered For $n = 0 To 2 $IPList[$n] = GUICtrlCreateInput("", 10, 10 + $n * 30, 200, 22) Next $but = GUICtrlCreateButton("try", 40, 120, 100, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $but Then setedcol(0x44eeff) Sleep(300) setedcol(0xffffff) Sleep(300) setedcol(0x44eeff) EndIf WEnd Func setedcol($icol) Local $n For $n = 0 To 2 If GUICtrlRead($IPList[$n]) = '' Then GUICtrlSetBkColor($IPList[$n], $icol) EndIf Next EndFunc ;==>setedcol Func WM_COMMAND($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) $hCtrl = $lParam If $nNotifyCode = $EN_CHANGE Then GUICtrlSetBkColor($nID, 0xffffff) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
martin Posted April 17, 2008 Share Posted April 17, 2008 Using the method you described how would you notify them if a combo box was left empty? I don't think you can set a background color on that right? Any ideas on that? Seems a bit more difficult. Without going into owner drawn comboboxes, here's a way to cheat. (Very untidy but just an idea.) expandcollapse popup#include <guiEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> Dim $IPList[3];the inputs Global $settoCombo = "", $comboY = 170 $gui = GUICreate("My GUI edit", 400, 500); will create a dialog box that when displayed is centered For $n = 0 To 2 $IPList[$n] = GUICtrlCreateInput("", 10, 10 + $n * 30, 200, 22) Next $comb = GUICtrlCreateCombo("", 50, $comboY, 200, 22);, $WS_CLIPSIBLINGS) $lab = GUICtrlCreateInput("", 50, $comboY, 180, 20) $but = GUICtrlCreateButton("try", 40, 120, 100, 25) GUISetState() GUICtrlSetState($lab, $GUI_HIDE) Global $bComb = False Global $labstate = 0;hidden GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $but Then $bComb = GUICtrlRead($comb) = "" setedcol(0x44eeff, $bComb) Sleep(300) setedcol(0xffffff, $bComb) Sleep(300) setedcol(0x44eeff, $bComb) EndIf If $settoCombo <> "" Then ControlMove($gui, "", $comb, 50, $comboY, 200, 22) ControlFocus($gui, "", $comb) Send($settoCombo);GUICtrlSetData($comb,$settoCombo,$settoCombo) $settoCombo = '' EndIf WEnd Func setedcol($icol, $cmb) Local $n If $bComb Then GUICtrlSetState($lab, $GUI_SHOW) ControlMove($gui, "", $comb, 230, $comboY, 20, 22) EndIf For $n = 0 To 2 If GUICtrlRead($IPList[$n]) = '' Then GUICtrlSetBkColor($IPList[$n], $icol) EndIf If $bComb Then GUICtrlSetBkColor($lab, $icol) Next EndFunc ;==>setedcol Func WM_COMMAND($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) $hCtrl = $lParam If $nNotifyCode = $EN_CHANGE Then GUICtrlSetBkColor($nID, 0xffffff) If $nID = $lab Then $settoCombo = GUICtrlRead($lab) GUICtrlSetState($lab, $GUI_HIDE) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 17, 2008 Share Posted April 17, 2008 Hi, what about checking the values in a loop and after all are valid the button is available. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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