#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 , 4 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
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 , 4 years ago
$GUI_ONTOP is meant for GUI's and not for GUI Controls. Isn't it?
comment:5 by , 4 years ago
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 , 4 years ago
| 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 , 4 years ago
| 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 , 4 years ago
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)