Jump to content

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


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

@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).

Link to comment
Share on other sites

@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.

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

×
×
  • Create New...