Jump to content
Sign in to follow this  
Spenhouet

as long as anything typed in inputbox -> enable other without pressing (Enter...)

Recommended Posts

Spenhouet

Hi AutoIT Forum.

I posted this in another Thread with another approach.

But the tendency was unhelpful.

Now then once again.

I have some inputboxes...

I want that, as long as anything typed in the first inputbox the second is enabled without pressing Enter/Ok..

Thx

Spenhouet

Share this post


Link to post
Share on other sites
Skitty

Nice thread tags.

Also, you're not making much (enough) sense. At least to me.

Can you give us some more in depth information on how the event should occur?

Edit: it would also help if you posted the GUI code you already have.

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
Spenhouet

@ApudAngelorum: The GUI code is a bit long....

Yes, of course i can give you more in depth information.

as an example:

2 x Inputbox

The first is enabled and the second is disabled.

Normaly if i typ anything in the first inputbox (and told that the second inputbox shoud enable if string lengh is longer then 1 for example) the second won't enable until i pressed Enter or somthing like that. (and the other way around (clear the inputbox))

My wish is that the second inputbox automaticaly gets enabled and disabled if somthing is typed in the firs inputbox or not.

(Aktion by input.. or somthing like that).

Share this post


Link to post
Share on other sites
Skitty

@ApudAngelorum: The GUI code is a bit long....

Yes, of course i can give you more in depth information.

as an example:

2 x Inputbox

The first is enabled and the second is disabled.

Normaly if i typ anything in the first inputbox (and told that the second inputbox shoud enable if string lengh is longer then 1 for example) the second won't enable until i pressed Enter or somthing like that. (and the other way around (clear the inputbox))

My wish is that the second inputbox automaticaly gets enabled and disabled if somthing is typed in the firs inputbox or not.

(Aktion by input.. or somthing like that).

Try this.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 283, 132, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Input1 = GUICtrlCreateInput("", 56, 24, 121, 21)
$Input2 = GUICtrlCreateInput("", 80, 64, 121, 21)
GUICtrlSetState($Input2,$GUI_DISABLE)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit
    If Not IsHWnd($Input1) Then $hWndEdit = GUICtrlGetHandle($Input1)
    $hWndFrom = $ilParam
    $iIDFrom = _WinAPI_LoWord ($iwParam)
    $iCode = _WinAPI_HiWord ($iwParam)
    Switch $hWndFrom
        Case $Input1, $hWndEdit
            Switch $iCode
                Case $EN_CHANGE  ; Sent when the user has taken an action that may have altered text in an edit control
     If (StringLen(GUICtrlRead($Input1)) > 3) Then;Or (StringLower(GUICtrlRead($Input1)) == "autoit") Then
      GUICtrlSetState($Input2,$GUI_ENABLE)
     Else
      GUICtrlSetState($Input2,$GUI_DISABLE)
     EndIf
;~               Case $EN_KILLFOCUS  ; Sent when an edit control loses the keyboard focus
;~    AdlibRegister("HideCTRL",200)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
Func Form1Close()
Exit
EndFunc

I forgot where I got it but you can find a better WM_COMMAND function if you google it.

  • Like 1

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
Spenhouet

Thx. ;) That helped me a lot :)

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • Ackerz
      By Ackerz
      Hi guys,
      So I am trying to automate a task and this task has an input box with an already set character "9". 
      I have just decided that I don't really need the input as an option but it's good to leave however for this instance I would like it to run past this point automatically. I've tried numerous ways to try and automate the use of the "OK" button using ControlClick and various other options. I just can't seem to see where this point in the script is. Scoured the forums for anything similar but didn't have any luck finding anything. Sorry to be a pain and I hope someone can help, if I haven't explained in enough detail please don't hesitate to ask for more.
      Many thanks,
      Ackerz
       
      Local $len Local $n Local $buff Local $aMyDate $Len = InputBox("Test",$msgPrompt,"9") $len = StringStripWS($len,$STR_STRIPALL) ;Check that user has entered a vaild password length if not StringIsDigit($len) or $len = 0 Then MsgBox(48,"Error","Invaild Integer was entered" & @CRLF & "Program will now exit.") Exit EndIf ;This creates the random password. for $i = 1 to $Len ;Pick a random char between 1 and the pwsMask Length $n = int(random(1,StringLen($pwsMask))) ;Concat each char that has been picked out of pwsMask to $buff $buff = $Buff & StringMid($pwsmask,$n,1) Next  
    • ramin92003
      By ramin92003
      Hi, 
      Is there any possibility to change the cancel button text to quit in the Inputbox?
    • Silas
      By Silas
      Hello everyone,
      I have a radio button ($Radio1), which I want to disable as soon as another one get's checked (Radio5). (The system fails if the radio button i'm troubling with also gets checked).
      I know how to disable him:
      If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_DISABLE) Then GUICtrlSetState($Radio5, 128) But if i try to enable $Radio5 again, after $Radio1 isn't checked anymore, it fails:
      If GUICtrlRead($Radio1)=Not 1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) Then GUICtrlSetState($Radio5, 64)  
      Anyone knows why?
    • pixelsearch
      By pixelsearch
      Hi everybody,
      I wanted to share with you this short piece of code where InputBox will always be on top (it's important to have it on top, kind of "MsgBox style") .  It's the shortest way I found to make it happen, with few lines of code :
      Do $sNb_Quest = InputBox("Quiz", "How many questions to answer ? (1-99)", "10", " M2", _ 220, 140, Default, Default, 0, GUICreate("", 0, 0, 0, 0, Default, @SW_SHOWDEFAULT)) If @error = 1 Then MsgBox(4096, "End of script", "You choosed to Quit") Exit EndIf GUIDelete() ; place this line here, not just after InputBox, or @error will be reset to 0 $iNb_Quest = Number($sNb_Quest) Until $iNb_Quest > 0 And IsInt($iNb_Quest) = 1 MsgBox(4096, "Result", "Your choice : " & $iNb_Quest) In the precedent code, the user can't type more than 2 characters. Inputs like "0" or ".5" or "-1" will be automatically rejected, also the Input is mandatory, default is 10. The last parameter, GUICreate, is the key to have this InputBox always on top (in a quick way)

      My question is : should GUIDelete() be present in the code or can we delete that line ?
      It seems to work fine without the GUIDelete() line, but in case the loop repeats several times (because of bad inputs), then we will have several GUICreate() without a single GUIDelete() ?
      Thanks for... your input 
       
    • dmkirkland
      By dmkirkland
      I'm wondering if, once again, I might be able to get some assistance from those of you who are much more knowledgeable than I. I have written a function that uses an InputBox and asks for the name of the adapter the user wants to manipulate. The script is designed to assign the name of the adapter to the entire program (a global variable) for use in other functions throughout its use. It can also be called again to change the adapter or, if it mistakenly didn't get set, set it. The issue I'm having is that I can't figure out a way to keep the function from "clearing" or "deleting" the variable if the cancel button is pressed. The idea is that if the user assigns the variable at the start of the program running (the function is called before anything else happens in the script) then, mistakenly/accidentally, runs the function again and, at the InputBox, the user clicks "Cancel" it will leave the variable alone. Currently, I've been able to (after much trial, tribulation, and troubleshooting) get it actually cancel the operation when "Cancel" is pressed or assign the variable as needed/preferred when the information is entered and "OK" is pressed. However, if "Cancel" is pressed (again, after the variable has already been assigned), it completely clears the variable's assignment (as evidenced by calling the variable in another function. Below is the code for the function. Please let me know if more functions are needed for diagnosis.
      Func selectAdapter()
          Global $adapterName
          $adapterName = InputBox("Select Adapter", "Please input the adapter name" & @CRLF & @CRLF & "or leave it at the default:", "Ethernet")
          If @error = 1 Then
              Return
          EndIf
      EndFunc
×