AmphetaMarinE Posted May 2, 2008 Posted May 2, 2008 Hi Guys, In a gui I am designing, the first thing the user sees is a login prompt, with input controls for username and password, a login button, and a cancel button, as per the following... $Username = GUICtrlCreateInput('Username', 128, 136, 241, 21) $Password = GUICtrlCreateInput('', 128, 176, 241, 21,$ES_PASSWORD) $Login = GUICtrlCreateButton('Login', 312, 216, 75, 25, 0) $Cancel = GUICtrlCreateButton('Cancel', 400, 216, 75, 25, 0)oÝ÷ Ø-êÞj|°k+h±ëm«mꮢÑ'µêêºd{*'¶¤{&èj·pYZ²²Ç§vØ^z«¢½©^Újëh×6Case $Login Regardless of which control currently has focus? Similar to how "ESC" key will always send an exit command? I have tried using hotkeys, but this causes me further problems later in the script.
RAMzor Posted May 2, 2008 Posted May 2, 2008 $Username = GUICtrlCreateInput('Username', 128, 136, 241, 21) $Password = GUICtrlCreateInput('', 128, 176, 241, 21,$ES_PASSWORD) $Login = GUICtrlCreateButton('Login', 312, 216, 75, 25, $BS_DEFPUSHBUTTON ) ; $Cancel = GUICtrlCreateButton('Cancel', 400, 216, 75, 25, 0) For description see GUI Control Styles -> Push Button Styles in AutoIt help P.S. Not tested
rasim Posted May 2, 2008 Posted May 2, 2008 AmphetaMarinETry this:#include <GuiConstants.au3> Global $Key = False HotKeySet("{Enter}", "_PressButton") $hGUI = GUICreate("Test", 300, 200) $Username = GUICtrlCreateInput('Username', 20, 20, 241, 21) $Password = GUICtrlCreateInput('', 20, 50, 241, 21,$ES_PASSWORD) $Login = GUICtrlCreateButton('Login', 20, 170, 75, 25, $BS_DEFPUSHBUTTON) $Cancel = GUICtrlCreateButton('Cancel', 200, 170, 75, 25, 0) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $Cancel ExitLoop Case $Login ConsoleWrite("Login button pressed" & @LF) EndSwitch If $Key = True Then $Key = False ConsoleWrite("Login button pressed" & @LF) EndIf WEnd Func _PressButton() $Key = True EndFunc
AmphetaMarinE Posted May 2, 2008 Author Posted May 2, 2008 $Login = GUICtrlCreateButton('Login', 312, 216, 75, 25, 0) Thanks guys... I found the problem... the extra ,0 at the end was stopping $BS_DEFPUSHBUTTON from working as it should.... (I had tried that before posting...)
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