Opened on Apr 10, 2022 at 1:25:36 PM
Closed on Apr 12, 2022 at 11:15:10 AM
Last modified on Aug 27, 2022 at 1:35:40 PM
#3877 closed Bug (Fixed)
$GUI_ONTOP hides the control when already on top
| Reported by: | Nine | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.16.1 | Component: | AutoIt |
| Version: | 3.3.16.0 | Severity: | None |
| Keywords: | Cc: |
Description (last modified by )
Setting the button to $GUI_ONTOP makes it disappear :
#include <GUIConstants.au3> Local $hGUI = GUICreate("Example", 300, 200, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(0xC0C0C0) Local $idLabel = GUICtrlCreateLabel("", 0, 0, 300, 200, Default, $GUI_WS_EX_PARENTDRAG) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idLabel ConsoleWrite("Label" & @CRLF) EndSwitch WEnd
Giving focus ($GUI_FOCUS) to the button is a workaround, but when GUI has hundred controls it is hardly viable.
Attachments (0)
Change History (8)
comment:1 by , on Apr 10, 2022 at 9:07:40 PM
| Description: | modified (diff) |
|---|
comment:3 by , on Apr 12, 2022 at 7:28:07 AM
Nice catch @pixelsearch
I will add to the doc pointing to this article
https://social.msdn.microsoft.com/Forums/en-US/dcd6a33c-2a6f-440f-ba0b-4a5fa26d14bb/when-to-use-wsclipchildren-and-wsclipsibilings-styles?forum=vcgeneral
I will not change the default as this article point out a little perf draw back
follow-up: 5 comment:4 by , on Apr 12, 2022 at 10:50:01 AM
$GUI_ONTOP is meant for GUI's and not for GUI Controls. Isn't it?
comment:5 by , on Apr 12, 2022 at 10:54:41 AM
Replying to anonymous:
$GUI_ONTOP is meant for GUI's and not for GUI Controls. Isn't it?
Sorry. Never mind. Looked it up.
comment:6 by , on Apr 12, 2022 at 11:15:10 AM
| Milestone: | → 3.3.15.6 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [12703] in version: 3.3.15.6
comment:7 by , on Apr 30, 2022 at 4:37:17 PM
| Milestone: | 3.3.15.6 → 3.3.16.1 |
|---|---|
| Owner: | changed from to |
Fixed by revision [12713] in version: 3.3.16.1
comment:8 by , on Aug 27, 2022 at 1:35:40 PM
kurtykurtyboy indicates another working solution : adding $WS_EX_COMPOSITED as GUI extended style, which does the job in Nine's script above.
It's good to know we got 2 workable solutions when controls overlap : $WS_CLIPSIBLINGS as style for the background control, or $WS_EX_COMPOSITED as GUI extended style.
kurtykurtyboy's link in the Forum :
https://www.autoitscript.com/forum/topic/197654-guiflatbutton-udf-change-colors-of-regular-buttons/?do=findComment&comment=1506292

Adding a $WS_CLIPSIBLINGS style when creating the label seems to solve the issue in the script presented above, where controls overlap. Is this solution ok ?
Local $idLabel = GUICtrlCreateLabel("", 0, 0, 300, 200, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG)