Luigi Posted February 1, 2020 Posted February 1, 2020 Greetings, (sorry my english) I cannot to minimize a secondary GUI. How do it? I need SLAVE's GUI to be a MASTER's parent. Two buttons on task bar is not good. #1 Line 63 ;$SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2], -1, -1, -1, -1, $MASTER) Line 64 $SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2]) In this case, if you click button SLAVE on task bar, minimize MASTER and SLAVE. I want minimize everything. But I want show only one button: MASTER. #2 Line 63 $SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2], -1, -1, -1, -1, $MASTER) Line 64 ;$SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2]) In this case, if you click button MASTER, minimize not work. But, SLAVE is a parent's MASTER. I want this. Question: How do make a SLAVE's gui be a MASTER's parent? And click on SLAVE and minimize both? Best regards. temp_001.au3 Visit my repository
pixelsearch Posted February 1, 2020 Posted February 1, 2020 (edited) 6 hours ago, Luigi said: Two buttons on task bar is not good... But I want show only one button: MASTER... And click on SLAVE and minimize both... Hi Luigi, I added/modified/commented 5 lines in your script, it should do it : expandcollapse popup;~ #AutoIt3Wrapper_AU3Check_Parameters= -q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ;~ #Tidy_Parameters=/sf #include-once #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; <========== 1) added OnAutoItExitRegister("OnExit") Opt("GUIOnEventMode", 1) Opt("GUIEventOptions", 1) Opt("MustDeclareVars", 1) Opt("WinWaitDelay", 0) Global $aMASTER[3] = ["MASTER", 320, 240] Global $aSLAVE[3] = ["SLAVE", 240, 160] Global $sGuiTitle = "GuiTitle" Global $hButton Global $MASTER, $SLAVE MASTER() While Sleep(25) WEnd Func OnExit() GUISetState($MASTER, @SW_HIDE) GUIDelete($MASTER) EndFunc ;==>OnExit Func MASTER() $MASTER = GUICreate($aMASTER[0], $aMASTER[1], $aMASTER[2]) GUISetOnEvent($GUI_EVENT_CLOSE, "MASTER_Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "MASTER_Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "MASTER_Restore") $hButton = GUICtrlCreateButton("SLAVE", 10, 10, 80, 26) GUICtrlSetOnEvent($hButton, "SLAVE") GUISetState(@SW_SHOW, $MASTER) EndFunc ;==>MASTER Func MASTER_Close() ConsoleWrite("MASTER_Close" & @LF) Exit EndFunc ;==>MASTER_Close Func MASTER_Minimize() ConsoleWrite("MASTER_Minimize" & @LF) WinSetState($MASTER, "", @SW_MINIMIZE) EndFunc ;==>MASTER_Minimize Func MASTER_Restore() ConsoleWrite("MASTER_Restore" & @LF) WinSetState($MASTER, "", @SW_RESTORE) EndFunc ;==>MASTER_Restore Func SLAVE() ConsoleWrite("SLAVE" & @LF) GUISetState(@SW_DISABLE, $MASTER) $SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2], -1, -1, -1, $WS_EX_MDICHILD, $MASTER) ; <========== 2) modified ;~ $SLAVE = GUICreate($aSLAVE[0], $aSLAVE[1], $aSLAVE[2]) GUISetOnEvent($GUI_EVENT_CLOSE, "SLAVE_Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SLAVE_Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "SLAVE_Restore") GUISwitch($SLAVE) GUISetState(@SW_SHOW, $SLAVE) EndFunc ;==>SLAVE Func SLAVE_Close() ConsoleWrite("SLAVE_Close" & @LF) GUISwitch($MASTER) GUISetState(@SW_ENABLE, $MASTER) GUIDelete($SLAVE) EndFunc ;==>SLAVE_Close Func SLAVE_Minimize() ConsoleWrite("SLAVE_Minimize" & @LF) WinSetState($MASTER, "", @SW_MINIMIZE) ; WinSetState($SLAVE, "", @SW_MINIMIZE) ; <========== 3) commented EndFunc ;==>SLAVE_Minimize Func SLAVE_Restore() ConsoleWrite("SLAVE_Restore" & @LF) ; WinSetState($MASTER, "", @SW_RESTORE) ; <========== 4) commented ; WinSetState($SLAVE, "", @SW_RESTORE) ; <========== 5) commented EndFunc ;==>SLAVE_Restore Edited February 1, 2020 by pixelsearch "I think you are searching a bug where there is no bug..."
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now