bowker Posted June 27, 2018 Posted June 27, 2018 Hi there! I don't know if I'm posting it in the right place, but yeah, sorry for that Anyway, Does GUICtrlCreateInput() have the functionality for mandatory Input like InputBox()? I know that in InputBox(), putting the letter M after the first character indicates that input is mandatory, so clicking the ok button will do nothing. Does GuiCtrlCreateInput() have one? or do I need to manually do it using condition and loops?
Subz Posted June 27, 2018 Posted June 27, 2018 An InputBox is a standalone function, whereas GuiCtrlCreateInput requires it's own Gui, within the Gui you can define these settings for example before the user clicks submit, you can get it to check that the input has a value etc..., basic example below. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Example() Func Example() GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, $WS_EX_ACCEPTFILES) Local $idInput1 = GUICtrlCreateInput("", 10, 5, 205, 20) _GUICtrlEdit_SetCueBanner ($idInput1, "<Folder Path> *Required", True) Local $idBrowse = GUICtrlCreateButton("Browse...", 220, 5, 90, 20) Local $idInput2 = GUICtrlCreateInput("", 10, 35, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBrowse Local $sBrowse = FileSelectFolder("Please Select Folder...", "") If @error Then ContinueLoop GUICtrlSetData($idInput1, $sBrowse) Case $idBtn If GUICtrlRead($idInput1) = "" Then ContinueLoop MsgBox(4096, "InputBox1", "Select Folder Path Required") If FileExists(GUICtrlRead($idInput1)) = 0 Then ContinueLoop MsgBox(4096, "InputBox1", GUICtrlRead($idInput1) & " is not a valid folder path.") EndSwitch WEnd EndFunc ;==>Example
Moderators JLogan3o13 Posted June 27, 2018 Moderators Posted June 27, 2018 @bowker in shorter answer to your question, No, there is no parameter you can use during initialization of the GuiCtrlCreateInput that will make it mandatory. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
bowker Posted June 28, 2018 Author Posted June 28, 2018 @JLogan3o13 I see. Thank you very much for answering @Subz Thank you for giving an example I will try to implement the logic to my code
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