Modify

Opened 12 years ago

Closed 12 years ago

#276 closed Bug (No Bug)

$GUI_DISABLE on a control blocks OnEvent ESC button msg

Reported by: smashly Owned by:
Milestone: Component: AutoIt
Version: 3.2.11.12 Severity: None
Keywords: Cc:

Description

Run the code below, Hit the ESC key and it works as it should.
Run the code again and hit the Log In button and then hit the ESC key.
Until the GUI has lost focus and gained focus again the ESC key will not work. The problem can be replicated in earlier versions of autoit as well.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 1)

Global $mW = @DesktopWidth, $mH = @DesktopHeight

$hMain = GUICreate("Point Of Sale", $mW, $mH, 0, 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainEvent", $hMain)

$LogIn = GUICtrlCreateButton("Log In", ($mW / 2) - 75, ($mH / 2) + 25, 150, 20)
GUICtrlSetOnEvent(-1, "MainEvent")

GUISetState(@SW_SHOW, $hMain)

While 1
	Sleep(100)
WEnd

Func MainEvent()
	Switch @GUI_CtrlId
		Case $GUI_EVENT_CLOSE
			Exit
		Case $LogIn
			GUICtrlSetState($LogIn, $GUI_DISABLE)
	EndSwitch
EndFunc   ;==>MainEvent


Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by anonymous

Further note:
I was using English WinXP SP2 when I noticed this.
Seems that the Button retains focus after being disabled.
So if there isn't another control to set focus to before disabling the button then just about any key press registers as a key press on the disabled control which results in a "Donk" sound for hitting the disabled control.
Clicking the gui client area wont kill the disabled button focus either.
Lose the gui focus then activate the gui again or click/set focus to another control (providing there is another control to set focus to)and then the disabled control loses focus as it should.


comment:2 Changed 12 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

This is not our responsibility. If you are disabling a control, it is up to you to ensure that focus goes somewhere sensible. We can not choose sensible for you. This is NO BUG and should not be changed.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.