myspacee Posted February 15, 2010 Share Posted February 15, 2010 Hello to all, see example of child gui : expandcollapse popup;==================================================== ;============= Example of a child window ============ ;==================================================== ; AutoIt version: 3.0.103 ; Language: English ; Author: "SlimShady" ; ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ;Include constants #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() ;Initialize variables Local $GUIWidth = 250, $GUIHeight = 250 Local $ParentWin, $ParentWin_Pos, $ChildWin, $msg ;Create main/parent window $ParentWin = GUICreate("Parent GUI", $GUIWidth, $GUIHeight) ;Save the position of the parent window $ParentWin_Pos = WinGetPos($ParentWin, "") ;Show the parent window/Make the parent window visible GUISetState(@SW_SHOW) ;Create child window and add the parameter to make it the child of the parent window $ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $ParentWin) ;Show the child window/Make the child window visible GUISetState(@SW_SHOW) ;Switch to the parent window GUISwitch($ParentWin) ;Loop until: ;- user presses Esc when focused to the parent window ;- user presses Alt+F4 when focused to the parent window ;- user clicks the close button of the parent window While 1 ;After every loop check if the user clicked something in the GUI windows $msg = GUIGetMsg(1) Select ;Check if user clicked on a close button of any of the 2 windows Case $msg[0] = $GUI_EVENT_CLOSE ;Check if user clicked on the close button of the child window If $msg[1] = $ChildWin Then MsgBox(64, "Test", "Child GUI will now close.") ;Switch to the child window GUISwitch($ChildWin) ;Destroy the child GUI including the controls GUIDelete() ;Check if user clicked on the close button of the parent window ElseIf $msg[1] = $ParentWin Then MsgBox(64, "Test", "Parent GUI will now close.") ;Switch to the parent window GUISwitch($ParentWin) ;Destroy the parent GUI including the controls GUIDelete() ;Exit the script Exit EndIf EndSelect WEnd EndFunc ;==>_Main But this example allow to select also main gui when child is on screen. I want, when child is called, that main window is not selectable, but don't understand how... Anyone can teach me? Thank you, m. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2010 Moderators Share Posted February 15, 2010 myspacee,This is one way to do it - disable the parent GUI when the child GUI is visible: expandcollapse popup#include <GUIConstantsEx.au3> ; Create parent $hGUI = GUICreate("Parent", 500, 500) $hButton_Child = GUICtrlCreateButton("Child", 10, 10, 80, 30) $hButton_Test = GUICtrlCreateButton("Test", 10, 50, 80, 30) GUISetState() ; Create child $hGUI_Child = GUICreate("Child", 200, 200) GUISetState(@SW_HIDE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_Test MsgBox(0, "Test", "You pressed the button!") Case $hButton_Child GUISetState($GUI_DISABLE, $hGUI) GUISetState(@SW_SHOW, $hGUI_Child) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $hGUI_Child) GUISetState($GUI_ENABLE, $hGUI) ExitLoop EndSwitch WEnd EndSwitch WEndTry pressing the Test button when the child is visible! M23 pixelsearch and GoogleGonnaSaveUs 1 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
myspacee Posted February 15, 2010 Author Share Posted February 15, 2010 Melba thank you, this is the trick i use now, hope this was more easy to do... Thank you again, m. Link to comment Share on other sites More sharing options...
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