Reza10101 Posted March 13, 2020 Share Posted March 13, 2020 hello everyone I want to create a parent window with several child windows, I did something in koda but I had some problems! Problem: when I close the child window... the parent window also closes! #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 779, 501, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 352, 128, 75, 25) GUISetState(@SW_SHOW) $Form2 = GUICreate("Form2", 505, 350, 184, 116, -1, -1, $Form1) $Input1 = GUICtrlCreateInput("Input1", 184, 80, 121, 21) $Button2 = GUICtrlCreateButton("Button2", 208, 120, 75, 25) GUISetState(@SW_HIDE) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 WinSetState("Form2", '', @SW_SHOW) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2020 Moderators Share Posted March 13, 2020 Reza10101, I suggest reading the Managing Multiple GUIs tutorial in the Wiki - it explains how to avoid this problem. M23 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...
Reza10101 Posted March 13, 2020 Author Share Posted March 13, 2020 @Melba23 can you edit my code please? I 'm beginner and I'm in a hurry! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2020 Developers Share Posted March 13, 2020 (edited) 4 minutes ago, Reza10101 said: I'm in a hurry! Iam pretty sure you aren't willing to cough up €100 per hour to do the coding for you ...right? Edited March 13, 2020 by Jos Earthshine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Reza10101 Posted March 13, 2020 Author Share Posted March 13, 2020 @Jos You are absolutely right! I'm not an abuser bro ☹️ I never create a gui before like that and I don't have enough experience about parent and child windows. I 'm also studing the wiki... But I still haven't reached a conclusion. Link to comment Share on other sites More sharing options...
Reza10101 Posted March 13, 2020 Author Share Posted March 13, 2020 I found a function that I solved my problem! GUIGetMsg tnx everybody also I found this code from other topics: #Include <GuiConstantsEx.au3> Opt("MustDeclareVars",1) Dim $guimain, $guichild, $guibutton, $array_msg $guimain = GUICreate("",400,400) $guibutton = GUICtrlCreateButton("child",165,180,60,20) GUISetState(@SW_SHOW, $guimain) While 1 $array_msg = GUIGetMsg(1) Switch $array_msg[0] Case $guibutton $guichild = GUICreate("",200,200) GUISetState(@SW_SHOW, $guichild) Case $GUI_EVENT_CLOSE Switch $array_msg[1] Case $guichild GUISetState(@SW_HIDE, $guichild) Case $guimain Exit EndSwitch EndSwitch WEnd Solved! Link to comment Share on other sites More sharing options...
Colduction Posted March 13, 2020 Share Posted March 13, 2020 Hi @Reza10101, nice to meet you iranian boy You can also use Koda Form Designer to create gui forms and easily set child window and etc. Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2020 Share Posted March 13, 2020 4 hours ago, Jos said: Iam pretty sure you aren't willing to cough up €100 per hour to do the coding for you ...right? those are some cheap prices... lol, I was thinking 250 per My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
argumentum Posted March 13, 2020 Share Posted March 13, 2020 https://www.autoitscript.com/forum/topic/202039-animated-gui-gif-background/ ...there are examples all over this site Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Skysnake Posted March 18, 2020 Share Posted March 18, 2020 Try this on for size? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Zmy Posted March 18, 2020 Share Posted March 18, 2020 You can do this: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 779, 501, 192, 124) Local $Button1 = GUICtrlCreateButton("Button1", 352, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case -3 GUIDelete($Form1) Exit Case $Button1 _a() EndSwitch Sleep(10) WEnd Func _a($a = '') Local $Form2 = GUICreate("Form2", 505, 350, 184, 116, -1, -1, $Form1) Local $Input1 = GUICtrlCreateInput("Input1", 184, 80, 121, 21),$Button2 = GUICtrlCreateButton("Button2", 208, 120, 75, 25) GUISetState(@SW_SHOW,$Form2) While 1 Switch GUIGetMsg() Case -3 GUIDelete($Form2) WinActivate($Form1) ExitLoop EndSwitch Sleep(10) WEnd EndFunc 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