Jump to content
Sign in to follow this  
Rex

GuiCtrlSetOnEvent($input, "Func")

Recommended Posts

On my gui i have some input controles. I want to read and validate the contains of them so i have createt a GuiCtrlSetOnEvent for the input but nothing happens when i type / hit enter, how can i work me arount this problem ????

Striped code

Opt("GUIOnEventMode", 1)
$GUI = GuiCreate("Test", 763, 575,(@DesktopWidth-763)/2, (@DesktopHeight-570)/2 ,$WS_CAPTION+$WS_SYSMENU)
$Input_UserName = GuiCtrlCreateInput("User name (Network)", 20, 210, 280, 20)
GUICtrlSetTip(-1, "Type the username to conect to the network computer")
GUICtrlSetOnEvent($Input_UserName, "UserName")
While 1
    Sleep(1000)
WEnd
Func UserName()
    $Read = GUICtrlRead($Input_UserName)
    $Crypt = _StringEncrypt ( 1, $Read, "test" ,2 )
        IniWrite("Settings.ini", "Network", "UserName", $Crypt)
    $TEstRead = IniRead(@Scriptdir & "\Settings.ini", "Network", "UserName", "Error")
    EndFunc

Share this post


Link to post
Share on other sites

I dont think an even can be set for an input control. What you can do though is create a button that reads the input from the input control and decides what do do from there. Or you can probably capture the {ENTER} button while in the input control and have that do something.

Just some ideas,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I dont think an even can be set for an input control. What you can do though is create a button that reads the input from the input control and decides what do do from there. Or you can probably capture the {ENTER} button while in the input control and have that do something.

Just some ideas,

JS

<{POST_SNAPBACK}>

Hmm i wont create a button corse i already have lots of them on my gui :

Capture {ENTER} well that could work, but then i have to do a if {ENTER} elseif {TAB} elseif {PRIMARYDOWN} elseif {PRIMARYUP} and to be honest i don't even know how to capture the {ENTER} :(

So it sems that i have to do a Input check on exit, and if some error then throw user a msg, and do a dont exit thing until user correct problem(s) :(

Share this post


Link to post
Share on other sites

Might consider using GUICtrlGetState() and checking the $GUI_FOCUS and then setting focus using GUICtrlSetState() using $GUI_FOCUS as well. That will have to be in some sort of loop maybe your OnEvent or something.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Might consider using GUICtrlGetState() and checking the $GUI_FOCUS and then setting focus using GUICtrlSetState() using $GUI_FOCUS as well. That will have to be in some sort of loop maybe your OnEvent or something.

JS

<{POST_SNAPBACK}>

Hmm it's hard to be a AutoIt user wannabe :(

but sounds like a lot of work, not that i don't like work - i can se on it for hours :(

For now i thing i just du a on exit check things, if error do something :">

Share this post


Link to post
Share on other sites

Hmm i wont create a button corse i already have lots of them on my gui  :

Capture {ENTER} well that could work, but then i have to do a if {ENTER} elseif {TAB} elseif {PRIMARYDOWN} elseif {PRIMARYUP} and to be honest i don't even know how to capture the {ENTER}  :(

So it sems that i have to do a Input check on exit, and if some error then throw user a msg, and do a dont exit thing until user correct problem(s)  :(

<{POST_SNAPBACK}>

Put a button on your form, set it's state to $GUI_DefButton and it will get triggered when you hit Enter.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...