Modify

Opened 2 years ago

Closed 2 years ago

Last modified 21 months ago

#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 mLipok)

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 Changed 2 years ago by mLipok

  • Description modified (diff)

comment:2 Changed 2 years ago by pixelsearch

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)

comment:3 Changed 2 years ago by Jpm

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

comment:4 follow-up: Changed 2 years ago by anonymous

$GUI_ONTOP is meant for GUI's and not for GUI Controls. Isn't it?

comment:5 in reply to: ↑ 4 Changed 2 years ago by anonymous

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 Changed 2 years ago by Jpm

  • Milestone set to 3.3.15.6
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [12703] in version: 3.3.15.6

comment:7 Changed 2 years ago by Jon

  • Milestone changed from 3.3.15.6 to 3.3.16.1
  • Owner changed from Jpm to Jon

Fixed by revision [12713] in version: 3.3.16.1

comment:8 Changed 21 months ago by anonymous

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

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.