Jump to content
Sign in to follow this  

GUIOnEventMode + SetParent buttons do not work

Recommended Posts


1. For the operation of the main window buttons, it must be placed control (GUICtrlCreateDummy) is not suitable.
Added to GUICtrlCreateLabel code(", 0, 0, 0, 0)

2. Activation of child Windows is possible only GUISetState (@SW_SHOW, $GuiSettingsLeft) otherwise controls in child Windows and buttons in the parent window do not work (the second change without which does not work).
In _WinAPI_SetWindowPos $SWP_SHOWWINDOW replaced by $SWP_NOACTIVATE and added GUISetState to child Windows (@SW_SHOW, $GuiSettingsLeft)

3. The main window ($GuiSettings) commented out the style code and added $GUI_EVENT_RESTORE and $GUI_EVENT_MINIMIZE event codes to the listing
for health checks.

UPD1: _WinAPI_SetWindowPos the second parameter must be $HWND_BOTTOM (as is) if you put $HWND_TOP again not to operate the buttons of the parent window.

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GuiConstantsEx.au3>

Opt('GUIOnEventMode', 1)

$GuiSettings = GUICreate('Lang1', 500, 500);, Default, Default, $WS_THICKFRAME)
GUICtrlCreateLabel('', 0, 0, 0, 0)

$GuiSettingsLeft = GUICreate('', 0, 0, 0, 0, $WS_POPUPWINDOW)
$987456 = GUICtrlCreateLabel('PanelLeft', 0, 0, 60, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))

$GuiSettingsRight = GUICreate('', 0, 0, 0, 0, $WS_POPUPWINDOW)
$12431 = GUICtrlCreateLabel('PanelRight', 0, 0, 60, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))

_WinAPI_SetParent($GuiSettingsLeft,  $GuiSettings)
_WinAPI_SetParent($GuiSettingsRight, $GuiSettings)

_WinAPI_SetWindowPos($GuiSettingsLeft,  $HWND_BOTTOM, 1, 1, 100, WinGetClientSize($GuiSettings)[1] - 2, $SWP_NOACTIVATE)
_WinAPI_SetWindowPos($GuiSettingsRight, $HWND_BOTTOM, WinGetPos($GuiSettingsLeft)[2] + 5, 1, (WinGetClientSize($GuiSettings)[0] - WinGetPos($GuiSettingsLeft)[2]) - 6, WinGetClientSize($GuiSettings)[1] - 2, $SWP_NOACTIVATE)

GUISetState(@SW_SHOW, $GuiSettings)
GUISetState(@SW_SHOW, $GuiSettingsLeft)
GUISetState(@SW_SHOW, $GuiSettingsRight)

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUISettingsEvent', $GuiSettings)
GUISetOnEvent($GUI_EVENT_RESTORE, 'GUISettingsEvent', $GuiSettings)
GUISetOnEvent($GUI_EVENT_MINIMIZE, 'GUISettingsEvent', $GuiSettings)

GUICtrlSetOnEvent($12431, 'GUISettingsMenu')
GUICtrlSetOnEvent($987456, 'GUISettingsMenu')

Func GUISettingsEvent()

    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Beep(500, 1000)
            Beep(500, 1000)

Func GUISettingsMenu()
    Beep(500, 1000)

While 1


Edited by angrof

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this