Jump to content

GUICtrlCreateInput


Recommended Posts

hello all

pls anyone can tell me which 'Ex-Style' is used, that input in the inputbox should be a 'Must'. it should not be accepted if left 'empty'. (not found in help)

thanx in advance

randeep

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

hello all

pls anyone can tell me which 'Ex-Style' is used, that input in the inputbox should be a 'Must'. it should not be accepted if left 'empty'. (not found in help)

thanx in advance

randeep

$inputbox = GUICtrlCreateInput("", 10, 5, 300, 20)

$input = GUICtrlRead ($inputbox)

If $input = "" Then ExitLoop

Edited by ajit
Link to comment
Share on other sites

actually i have created the following function. which included a 'Submit' button. this button gets the value of 'InputBox' in $PubName = GUICtrlRead ($PubInput). now problem is that if i press the 'Submit' button without filling anything in 'InputBox' then the script continues. i wanna make 'Submit' button disabled or 'not working' if something is not filled in 'InputBox'.

randeep

$InputWindowHandle = GUICreate("Please provide Input", 225, 125)
                                        GUISetState(@SW_SHOW)
                                        GUICtrlCreateLabel("Please Provide the name of Publisher!", 25, 20)
                                        $PubInput = GUICtrlCreateInput("", 75, 50, 80)
                                        $PubSubmitButton = GUICtrlCreateButton("Submit", 85, 80, 60)
                                        Local $msg4
                                        GUISetState()

                                            While 1
                                                $msg4 = GUIGetMsg()
                                                Select
                                                    Case $msg4 = $PubSubmitButton
                                                         $PubName = GUICtrlRead ($PubInput)
                                                        GUIDelete()

                                                        Run ('osql -S ' & $PubName & ' -E -i "C:\T-MATRIX\Scripts\Drop Publisher.sql"')

                                                        IF @error <> 0 Then
                                                            MsgBox(1, "Error", "Not able to run script - 'Drop Publisher.sql'")
                                                            ;Return $RetValue = False
                                                        EndIf

                                                        sleep (30000)


                                                        ExitLoop

                                                    Case $msg4 = $GUI_EVENT_CLOSE
                                                        ExitLoop

                                                EndSelect



                                            WEnd

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

You got the answer in the @ajit's post, just use ContinueLoop instead of ExitLoop.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Button is disabled while textbox is blank

#include <GuiConstantsEx.au3>


$InputWindowHandle = GUICreate("Please provide Input", 225, 125)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("Please Provide the name of Publisher!", 25, 20)
$PubInput = GUICtrlCreateInput("", 75, 50, 80)
$PubSubmitButton = GUICtrlCreateButton("Submit", 85, 80, 60)
GuiCtrlSetState($PubSubmitButton, $GUI_Disable)
Local $msg4
GUISetState()
Local $Enabled = False
While 1
 $msg4 = GUIGetMsg()
        If GuiCtrlRead($PubInput) <> "" And $Enabled = False Then
            GuiCtrlSetState($PubSubmitButton, $GUI_ENABLE)
            $Enabled = True
        EndIf
  Select
   Case $msg4 = $PubSubmitButton
     $PubName = GUICtrlRead ($PubInput)
     GUIDelete()
         Run ('osql -S ' & $PubName & ' -E -i "C:\T-MATRIX\Scripts\DropPublisher.sql"')
         IF @error <> 0 Then
      MsgBox(1, "Error", "Not able to run script - 'Drop Publisher.sql'")
          ;Return $RetValue = False
     EndIf

    sleep (30000)

    ExitLoop

   Case $msg4 = $GUI_EVENT_CLOSE
    ExitLoop

EndSelect
WEnd

now problem is that if i press the 'Submit' button without filling anything in 'InputBox' then the script continues. i wanna make 'Submit' button disabled or 'not working' if something is not filled in 'InputBox'.

edit: better way Edited by i542

I can do signature me.

Link to comment
Share on other sites

There is much much better way to do this :D

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;

$InputWindowHandle = GUICreate("Please provide Input", 225, 125)
GUICtrlCreateLabel("Please Provide the name of Publisher!", 25, 20)
$PubInput = GUICtrlCreateInput("", 75, 50, 80)
$PubSubmitButton = GUICtrlCreateButton("Submit", 85, 80, 60)
GUICtrlSetState($PubSubmitButton, $GUI_Disable)

GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

Local $msg4

While 1
    $msg4 = GUIGetMsg()
    
    Select
        Case $msg4 = $PubSubmitButton
            $PubName = GUICtrlRead($PubInput)
            If StringStripWS($PubName, 8) == "" Then ContinueLoop
            
            GUIDelete()
            
            Run('osql -S ' & $PubName & ' -E -i "C:\T-MATRIX\Scripts\DropPublisher.sql"')
            
            If @error <> 0 Then
                MsgBox(1, "Error", "Not able to run script - 'Drop Publisher.sql'")
                ;Return $RetValue = False
            EndIf

            Sleep(30000)

            ExitLoop
        Case $msg4 = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Func WM_COMMAND($hWnd, $nMsg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $nID = BitAND($wParam, 0xFFFF)
    
    Switch $nID
        Case $PubInput
            Switch $nNotifyCode
                Case $EN_UPDATE
                    If StringStripWS(GUICtrlRead($PubInput), 8) == "" Then
                        GUICtrlSetState($PubSubmitButton, $GUI_DISABLE)
                    Else
                        GUICtrlSetState($PubSubmitButton, $GUI_ENABLE)
                    EndIf
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc

To make it even more "foolproof", i also added a checking process to the «Case $PubSubmitButton».

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@i542

hey thank you, very much. it is more than i was looking for.

Button is disabled while textbox is blank

#include <GuiConstantsEx.au3>


$InputWindowHandle = GUICreate("Please provide Input", 225, 125)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("Please Provide the name of Publisher!", 25, 20)
$PubInput = GUICtrlCreateInput("", 75, 50, 80)
$PubSubmitButton = GUICtrlCreateButton("Submit", 85, 80, 60)
GuiCtrlSetState($PubSubmitButton, $GUI_Disable)
Local $msg4
GUISetState()
Local $Enabled = False
While 1
 $msg4 = GUIGetMsg()
        If GuiCtrlRead($PubInput) <> "" And $Enabled = False Then
            GuiCtrlSetState($PubSubmitButton, $GUI_ENABLE)
            $Enabled = True
        EndIf
  Select
   Case $msg4 = $PubSubmitButton
     $PubName = GUICtrlRead ($PubInput)
     GUIDelete()
         Run ('osql -S ' & $PubName & ' -E -i "C:\T-MATRIX\Scripts\DropPublisher.sql"')
         IF @error <> 0 Then
      MsgBox(1, "Error", "Not able to run script - 'Drop Publisher.sql'")
          ;Return $RetValue = False
     EndIf

    sleep (30000)

    ExitLoop

   Case $msg4 = $GUI_EVENT_CLOSE
    ExitLoop

EndSelect
WEnd

edit: better way

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...