Modify

Opened 10 years ago

Closed 4 years ago

Last modified 4 years ago

#2943 closed Bug (Works For Me)

Disabled dummy control reacts on accelerators

Reported by: Synix <cross.fire@…> Owned by: Jon
Milestone: Component: AutoIt
Version: 3.3.13.19 Severity: None
Keywords: Cc:

Description

I noticed that in previous versions (3.3.12.0) $GUI_DISABLE didn't have any effect on accelerators. This is fixed in the beta, but unfortunately not completely.
Testing 3.3.13.19, $GUI_DISABLE disables accelerators for controls like buttons, but not for dummy controls.

This should not work:

#include <GUIConstantsEx.au3>

GUICreate("Hit Enter in this GUI")
$idDummy = GUICtrlCreateDummy()
GUICtrlSetState($idDummy, $GUI_DISABLE)
Global $aArray[1][2] = [["{ENTER}", $idDummy]]
GUISetAccelerators($aArray)
GUISetState()

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $idDummy
			MsgBox(0, "Dummy", "Entered")
	EndSwitch
WEnd

Another thing that I think should not be possible and may be related to this is GUICtrlSendToDummy:
GUICtrlSendToDummy() triggers events on disabled dummy controls, which I guess shouldn't be possible as well.

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by Melba23

What you are actually saying is that Dummy controls do not honour the $GUI_* states. Which does not surprise me in the slightest as I imagine that they are but a simple entry in the internal AutoIt control array, and do not exist as far as Windows is concerned so there is nothing on which Windows can apply the state.

It seems to me that if you want to "disable/enable" dummy controls then you need to delete/recreate them as necessary.

M23

comment:2 Changed 10 years ago by Synix <cross.fire@…>

But I can use and work with GUICtrlSetState and GUICtrlGetState on Dummy Controls without any problems o.O

comment:3 Changed 10 years ago by Synix <cross.fire@…>

Quick example:

#include <GUIConstantsEx.au3>

GUICreate("Hit Enter in this GUI")
$idButton = GUICtrlCreateButton("hit me", 5, 5)
$idDummy = GUICtrlCreateDummy()
Global $aArray[1][2] = [["{ENTER}", $idDummy]]
GUISetAccelerators($aArray)
GUISetState()

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $idButton
			If BitAND(GUICtrlGetState($idDummy), $GUI_DISABLE) = $GUI_DISABLE Then
				GUICtrlSetState($idDummy, $GUI_ENABLE)
			Else
				GUICtrlSetState($idDummy, $GUI_DISABLE)
			EndIf
			MsgBox(0, "", "Dummy state is " & (BitAND(GUICtrlGetState($idDummy), $GUI_DISABLE) = $GUI_DISABLE ? "disabled" : "enabled"))
	EndSwitch
WEnd

I guess the dummy control always should have the same behaviour as its native counterparts. That's why I reported the wrong behavior from my first example.

comment:4 Changed 10 years ago by Melba23

  • Owner set to Jon
  • Status changed from new to assigned

Point made.

M23

comment:5 Changed 4 years ago by Jpm

  • Resolution set to Works For Me
  • Status changed from assigned to closed

Hi,
It works for me with current release
Cheers

comment:6 Changed 4 years ago by mLipok

Confirmed.
Tested with modified script:

#include <GUIConstantsEx.au3>

_Example()

Func _Example()
        GUICreate("Hit Enter in this GUI")
        Local $idDummy = GUICtrlCreateDummy()
        Local $aArray[1][2] = [["{F10}", $idDummy]]
        GUICtrlSetState($idDummy, $GUI_DISABLE)
        GUISetAccelerators($aArray)
        GUISetState()

        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                Exit
                        Case $idDummy
                                If BitAND(GUICtrlGetState($idDummy), $GUI_DISABLE) = $GUI_DISABLE Then
                                        GUICtrlSetState($idDummy, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($idDummy, $GUI_DISABLE)
                                EndIf
                                MsgBox(0, "", "Dummy state is " & (BitAND(GUICtrlGetState($idDummy), $GUI_DISABLE) = $GUI_DISABLE ? "disabled" : "enabled"))
                EndSwitch
        WEnd
EndFunc   ;==>_Example

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 owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.