BrettF Posted April 5, 2008 Posted April 5, 2008 I have a button created as follows: $client_login_btn = GUICtrlCreateButton("Login", $login_offset_width + 115, $login_offset_height + 195, 100, 22, BitOR($BS_DEFPUSHBUTTON, $BS_FLAT)) The offsets are just to make the button dynamic to the screen size. Now when I try call my function in a normal GUIGetMsg loop, it seems to always call the function 2 times. And I only click it once. While 1 $nMSG = GUIGetMsg(0) Select Case $nMSG = $GUI_EVENT_CLOSE Exit Case _IsFocused($client_gui, $client_login_password) If GUICtrlRead($client_login_password) == "Password" Then GUICtrlSetData($client_login_password, "") EndIf Case _IsFocused($client_gui, $client_login_username) If GUICtrlRead($client_login_username) == "Username" Then GUICtrlSetData($client_login_username, "") EndIf Case $nMSG = $client_login_btn ;Remake the GUI to show the loading screen. GUICtrlSetImage($client_gui_bkg, "images\theme2.jpg") GUICtrlSetState($client_login_btn, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($client_login_password, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($client_login_username, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($client_gui_title, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($client_gui_welcome, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($client_status_label, $GUI_SHOW) _Login(GUICtrlRead($client_login_username), GUICtrlRead($client_login_password), 1) EndSelect WEnd You may recognise the _Login func from my other topic. It is the same thing Is there anything I'm doing wrong? I couldn't find a fix. Maybe I'm not using the right search terms... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
rasim Posted April 5, 2008 Posted April 5, 2008 Hi! Mayb problem here? Case _IsFocused($client_gui, $client_login_password) If GUICtrlRead($client_login_password) == "Password" Then GUICtrlSetData($client_login_password, "") EndIf Case _IsFocused($client_gui, $client_login_username) If GUICtrlRead($client_login_username) == "Username" Then GUICtrlSetData($client_login_username, "") EndIf
Distrophy Posted April 5, 2008 Posted April 5, 2008 (edited) I think your problem is Case $nMSG = $client_login_btn Should be Case $client_login_btn For example: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $test func() Case $button func2() EndSwitch Wend Edited April 5, 2008 by Distrophy
BrettF Posted April 5, 2008 Author Posted April 5, 2008 Hi! Mayb problem here? Case _IsFocused($client_gui, $client_login_password) If GUICtrlRead($client_login_password) == "Password" Then GUICtrlSetData($client_login_password, "") EndIf Case _IsFocused($client_gui, $client_login_username) If GUICtrlRead($client_login_username) == "Username" Then GUICtrlSetData($client_login_username, "") EndIfI don't think so, as that just sets the data of the input to be blank if it is focused, and the contents == what they should. I think your problem is Case $nMSG = $client_login_btn Should be Case $client_login_btn For example: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $test func() Case $button func2() EndSwitch WendWrong. Look up SELECT...Case...Case Else...EndSelect and Switch...Case...Case Else...EndSwitch. You will find thy are 2 different things... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
rover Posted April 5, 2008 Posted April 5, 2008 I've seen this problem with a message loop gui I finished back in December. I placed $msg = 0 after the problematic function(s) called in the Switch / Case / EndSwitch statements. I have only seen this in 3.2.8.1, haven't re-tested the script to confirm the problem without those $msg = 0 lines or updated and tested the script in 3.2.10.0 what the problematic functions had in common was disabling/hiding several controls, specifically the buttons that were just clicked. e.g. GUICtrlSetState($n4, $GUI_DISABLE + $GUI_HIDE) the script had many Switch/Case and Select/Case statements in the loop it may have to do with the control being disabled and after the message loop resumes the same button code is reused. use a ConsoleWrite to monitor $nMsg try commenting out this line in your script: ;GUICtrlSetState($client_login_btn, $GUI_DISABLE + $GUI_HIDE) ; Pseudocode While 1 $msg = GUIGetMsg() Switch $msg Case $n4 ; Extract Button _Extract() $msg = 0 EndSwitch WEnd I see fascists...
BrettF Posted April 5, 2008 Author Posted April 5, 2008 Hmmmmmmm... *looks at version* That could be the reason. I'll update then get back to you Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
rover Posted April 5, 2008 Posted April 5, 2008 Hmmmmmmm... *looks at version* That could be the reason. I'll update then get back to you In a related problem, it looks like it was fixed back around this beta.From the 3.2.10.0 changelog:3.2.9.2 (30th September, 2007) (Beta)- Fixed: Extra notification on colored button. (Thanks livewire)http://www.autoitscript.com/forum/index.php?showtopic=53366http://www.autoitscript.com/forum/index.php?showtopic=53363I tried the reproducer in the above post in 3.2.8.1 (still have it on one of my machines)very twitchy behaviour from the message queue! I see fascists...
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