DarkBanana Posted July 29, 2015 Share Posted July 29, 2015 Hey there,I started to work with tabs earlier today but I can't figure out what the problem is.expandcollapse popup#include <GuiTab.au3> #include <WindowsConstants.au3> Global $Height = @DesktopHeight Global $Width = @DesktopWidth $GUI = GUICreate("", $Width, $Height, 0, 0, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) GUICtrlCreateMenu("") $Tab = GUICtrlCreateTab(20,20,$Width/1.2,$Height/1.2) GUICtrlCreateTabItem("First") GUICtrlCreateTabItem("Second") GUISetState() $GUI_Child_1 = GUICreate("", $Width / 1.3, $Height / 1.3, 100, 100, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(0xCCFFCC) DllCall("user32.dll", "int", "SetParent", "hwnd", $GUI_Child_1, "hwnd", $GUI) GUISetState(@SW_SHOW) $GUI_Child_2 = GUICreate("", $Width / 1.3, $Height / 1.3, 100, 100, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(0xAAAAAAA) DllCall("user32.dll", "int", "SetParent", "hwnd", $GUI_Child_1, "hwnd", $GUI) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Tab $SelTab = _GUICtrlTab_GetCurSel($Tab) If $SelTab = 0 then GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_SHOW,$GUI_Child_1) EndIf If $SelTab = 1 then GUISetState(@SW_HIDE,$GUI_Child_1) GUISetState(@SW_SHOW,$GUI_Child_2) EndIf EndSwitch WEndIf you click twice on the second tab the ChildGUI will disappear and I would like to know why? What am I missing? Thanks for help. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 29, 2015 Share Posted July 29, 2015 If you move the GUI you'll see that child 2 isn't connected to the main GUI at all.so when you click the tab again, the gui goes to the back ground. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jguinch Posted July 29, 2015 Share Posted July 29, 2015 You main GUI has the focus so the child Window is behind.You can use the $WS_EX_MDICHILD exstyle for this :expandcollapse popup#include <GuiTab.au3> #include <WindowsConstants.au3> Global $Height = @DesktopHeight Global $Width = @DesktopWidth $GUI = GUICreate("", $Width, $Height, 0, 0, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) GUICtrlCreateMenu("") $Tab = GUICtrlCreateTab(20,20,$Width/1.2,$Height/1.2) GUICtrlCreateTabItem("First") GUICtrlCreateTabItem("Second") GUISetState() $GUI_Child_1 = GUICreate("", $Width / 1.3, $Height / 1.3, 100, 100, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xCCFFCC) GUISetState(@SW_SHOW) $GUI_Child_2 = GUICreate("", $Width / 1.3, $Height / 1.3, 100, 100, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xAAAAAAA) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Tab $SelTab = _GUICtrlTab_GetCurSel($Tab) Switch $SelTab Case 0 GUISetState(@SW_HIDE,$GUI_Child_2) GUISetState(@SW_SHOW,$GUI_Child_1) Case 1 GUISetState(@SW_HIDE,$GUI_Child_1) GUISetState(@SW_SHOW,$GUI_Child_2) EndSwitch EndSwitch WEnd Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
DarkBanana Posted July 29, 2015 Author Share Posted July 29, 2015 There's one wrong number.... I assigned Child 1 twice.DllCall("user32.dll", "int", "SetParent", "hwnd", $GUI_Child_1, "hwnd", $GUI) ;should be: DllCall("user32.dll", "int", "SetParent", "hwnd", $GUI_Child_2, "hwnd", $GUI)Thank you. 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