Modify

#4071 new Bug

$GUI_ONTOP sends labels to wrong end of z-order

Reported by: MattyD Owned by:
Milestone: Component: AutoIt
Version: 3.3.18.0 Severity: None
Keywords: Cc:

Description

Apologies if this should be a comment in #2287, I wasn't sure if that was still appropriate given the age of the ticket.

Anyway, the $GUI_ONTOP flag seems to send static controls to the wrong end of the z-order. Discussion is here:
https://www.autoitscript.com/forum/topic/213453-gui_ontop-label-controls/

Thanks,
Matt

#include <GUIConstants.au3>
#include <WinAPI.au3>

_Example()

Func _Example()
        Local $hGUI = GUICreate("Test", 300, 200)
        GUISetState()

        GUICtrlCreateLabel("Label 1", 30, 30, 200, 100, $WS_CLIPSIBLINGS)
        GUICtrlSetBkColor(-1, 0xFF0000)

        GUICtrlCreateLabel("Label 2", 50, 45, 200, 100, $WS_CLIPSIBLINGS)
        GUICtrlSetBkColor(-1, 0x00FF00)

        GUICtrlCreateButton("Button 1", 70, 60, 200, 100, $WS_CLIPSIBLINGS)
        GUICtrlSetBkColor(-1, 0x0000FF)

        GUICtrlCreateEdit("Edit 1", 90, 75, 200, 100, $WS_CLIPSIBLINGS)
        GUICtrlSetBkColor(-1, 0xFFFF00)

        Local $aMsg, $hCtrl, $idCtrl
        Local $tPoint = DllStructCreate($tagPoint)
        While 1
                $aMsg = GUIGetMsg(1)
                Switch $aMsg[0]
                        Case $GUI_EVENT_PRIMARYDOWN
                                ;Get control under the mouse.
                                $tPoint.X = $aMsg[3]
                                $tPoint.Y = $aMsg[4]
                                _WinAPI_ClientToScreen($aMsg[1], $tPoint)
                                $hCtrl = _WinAPI_WindowFromPoint($tPoint)
                                $idCtrl = _WinAPI_GetDlgCtrlID($hCtrl)
                                If Not $idCtrl Then ContinueLoop

                                ConsoleWrite(StringFormat("Clicked on CtrlID: %d (%s)", $idCtrl, GUICtrlRead($idCtrl))& @CRLF)

                                ;Labels go to the back, Button & Edit controls come to the front
                                GUICtrlSetState($idCtrl, $GUI_ONTOP)

                                ;All controls come to the front
;~                              _WinAPI_BringWindowToTop($hCtrl)

;~                              ;All controls come to the front
;~                              _WinAPI_SetWindowPos($hCtrl, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE))

                        Case $GUI_EVENT_CLOSE
                                ExitLoop
                EndSwitch
        WEnd

        GUIDelete($hGUI)
EndFunc

Attachments (0)

Change History (0)

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 new 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.