Sign in to follow this  
Followers 0
Vadersapien

GUI not hiding?

3 posts in this topic

Hi,

I while back I asked about the "Tab in Tab" situation, and was given the method of creating a child GUI to house the "tab in a tab". It works, except there is one problem: When you click another tab in the "parent" tab, the child GUI hides, yet no controls show where the child GUI was...here is my complete code:

#AutoIt3Wrapper_icon=dev-icon.ico
#NoAutoIt3Execute

#include <COM.au3>
#include <GUIConstantsEx.au3>
#Include <GUIStatusBar.au3>
#include <Icons.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>

;Set AutoIt Specific Options
AutoItSetOption('GUICloseOnESC', False)
AutoItSetOption('MustDeclareVars', True)
AutoItSetOption('TrayIconHide', True)

;Declare Variables
Local $ParentTab, $hParentTab
Local $PersonalitiesTab, $FileListPC, $FileListRobot, $PerPic, $hChildGUI
Local $LiveControlTab
Local $EditorTab
Local $MediaTab
Local $ApplicationsTab, $ApplicationsCatList
Local $JavaTab
Local $TimeTab
Local $StatusBar, $ProgressBar, $StatusBarParts[2] = [650, 150]

;Create GUI
Global $hGUI = GUICreate('RS Media Manager', 800, 600)

;Create GUI Content
$ParentTab = GUICtrlCreateTab(5, 5, 792, 568)
$hParentTab = GUICtrlGetHandle($ParentTab)

;Create 'Personalities' Tab Content
$PersonalitiesTab = GUICtrlCreateTabItem('Personalities')
GUICtrlCreateLabel('Computer', 10, 43)
$FileListPC = GUICtrlCreateList('', 10, 60, 320, 263, $LVS_SINGLESEL)
$PerPic = GUICtrlCreatePic('perpic.jpg', 334, 32, 132, 176)
GUICtrlCreateLabel('Robot', 470, 43)
$FileListRobot = GUICtrlCreateList('', 470, 60, 320, 263, $LVS_SINGLESEL)
$hChildGUI = GUICreate('', 780, 253, 5, 310, $WS_CHILD, -1, $hParentTab)
GUICtrlCreateTab(0, 0, 782, 253)
GUICtrlCreateTabItem('All')
GUICtrlCreateListView('Name|Description|Path', 5, 27, 770, 220)
GUICtrlCreateTabItem('Common')
GUICtrlCreateTabItem('Control Mode')
GUICtrlCreateTabItem('Arm Mode')
GUICtrlCreateTabItem('Bodycon')
GUICtrlCreateTabItem('')
GUISetState()

;Switch back to main GUI
GUISwitch($hGUI)

;Create 'Macro Editor' Tab Content
$LiveControlTab = GUICtrlCreateTabItem('Live Control')

;Create 'Macro Editor' Tab Content
$EditorTab = GUICtrlCreateTabItem('Editor')

;Create 'Media' Tab Content
$MediaTab = GUICtrlCreateTabItem('Media')

;Create 'Personalities' Tab Content
$ApplicationsTab = GUICtrlCreateTabItem('Applications')
$ApplicationsCatList = GUICtrlCreateListView(-1, 10, 31, 200, 536, $LVS_NOCOLUMNHEADER)


;Create 'Personalities' Tab Content
$JavaTab = GUICtrlCreateTabItem('Java')

;Create 'Time' Tab Content
$TimeTab = GUICtrlCreateTabItem('Time')

;End Tab
GUICtrlCreateTabItem('')

;Create Statusbar
$StatusBar = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBarParts)
_GUICtrlStatusBar_SetText($StatusBar, ' ' & 'Robot not connected', 0)
$ProgressBar = GUICtrlCreateProgress(0, 0)
GuiCtrlSetData($ProgressBar, 50)
_GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar))

;Show main GUI
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit

        Case $GUI_EVENT_RESTORE
            _GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar))

        Case $ParentTab
            Switch GUICtrlRead($ParentTab, 1)
                Case $PersonalitiesTab
                    GUISetState(@SW_SHOW, $hChildGUI)
                Case Else
                    GUISetState(@SW_HIDE, $hChildGUI)
            EndSwitch
    EndSwitch
WEnd

Try clicking on the "Applications" tab. You'll see what I mean...


Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.

Share this post


Link to post
Share on other sites



This works fine for me. Maybe and extra _WinAPI_RedrawWindow() does the trick?

#AutoIt3Wrapper_icon=dev-icon.ico
#NoAutoIt3Execute

;#include <COM.au3>
#include <GUIConstantsEx.au3>
#Include <GUIStatusBar.au3>
;#include <Icons.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>

;Set AutoIt Specific Options
AutoItSetOption('GUICloseOnESC', False)
AutoItSetOption('MustDeclareVars', True)
AutoItSetOption('TrayIconHide', True)

;Declare Variables
Local $ParentTab, $hParentTab
Local $PersonalitiesTab, $FileListPC, $FileListRobot, $PerPic, $hChildGUI, $hChildGUI2
Local $LiveControlTab
Local $EditorTab
Local $MediaTab
Local $ApplicationsTab, $ApplicationsCatList
Local $JavaTab
Local $TimeTab
Local $StatusBar, $ProgressBar, $StatusBarParts[2] = [650, 150]

;Create GUI
Global $hGUI = GUICreate('RS Media Manager', 800, 600)

;Create GUI Content
$ParentTab = GUICtrlCreateTab(5, 5, 792, 568)
$hParentTab = GUICtrlGetHandle($ParentTab)

;Create 'Personalities' Tab Content
$PersonalitiesTab = GUICtrlCreateTabItem('Personalities')
GUICtrlCreateLabel('Computer', 10, 43)
$FileListPC = GUICtrlCreateList('', 10, 60, 320, 263, $LVS_SINGLESEL)
$PerPic = GUICtrlCreatePic('perpic.jpg', 334, 32, 132, 176)
GUICtrlCreateLabel('Robot', 470, 43)
$FileListRobot = GUICtrlCreateList('', 470, 60, 320, 263, $LVS_SINGLESEL)

$hChildGUI = GUICreate('', 780, 253, 5, 310, $WS_CHILD, -1, $hParentTab)
GUICtrlCreateTab(0, 0, 782, 253)
GUICtrlCreateTabItem('All')
GUICtrlCreateListView('Name|Description|Path', 5, 27, 770, 220)
GUICtrlCreateTabItem('Common')
GUICtrlCreateTabItem('Control Mode')
GUICtrlCreateTabItem('Arm Mode')
GUICtrlCreateTabItem('Bodycon')
GUICtrlCreateTabItem('')
GUISetState()

;Switch back to main GUI
GUISwitch($hGUI)

;Create 'Macro Editor' Tab Content
$LiveControlTab = GUICtrlCreateTabItem('Live Control')

$hChildGUI2 = GUICreate('', 780, 253, 5, 310, $WS_CHILD, -1, $hParentTab)
GUICtrlCreateTab(0, 0, 782, 253)
GUICtrlCreateTabItem('All2')
GUICtrlCreateListView('Name|Description|Path', 5, 27, 770, 220)
GUICtrlCreateTabItem('Common')
GUICtrlCreateTabItem('Control Mode')
GUICtrlCreateTabItem('Arm Mode')
GUICtrlCreateTabItem('Bodycon')
GUICtrlCreateTabItem('')

;Switch back to main GUI
GUISwitch($hGUI)


;Create 'Macro Editor' Tab Content
$EditorTab = GUICtrlCreateTabItem('Editor')

;Create 'Media' Tab Content
$MediaTab = GUICtrlCreateTabItem('Media')

;Create 'Personalities' Tab Content
$ApplicationsTab = GUICtrlCreateTabItem('Applications')
$ApplicationsCatList = GUICtrlCreateListView(-1, 10, 31, 200, 536, $LVS_NOCOLUMNHEADER)

;Create 'Personalities' Tab Content
$JavaTab = GUICtrlCreateTabItem('Java')

;Create 'Time' Tab Content
$TimeTab = GUICtrlCreateTabItem('Time')

;End Tab
GUICtrlCreateTabItem('')

;Create Statusbar
$StatusBar = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBarParts)
_GUICtrlStatusBar_SetText($StatusBar, ' ' & 'Robot not connected', 0)
$ProgressBar = GUICtrlCreateProgress(0, 0)
GuiCtrlSetData($ProgressBar, 50)
_GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar))

;Show main GUI
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit

        Case $GUI_EVENT_RESTORE
            _GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar))

        Case $ParentTab
            Switch GUICtrlRead($ParentTab, 1)
                Case $PersonalitiesTab
                    GUISetState(@SW_SHOW, $hChildGUI)
                    GUISetState(@SW_HIDE, $hChildGUI2)
                Case $LiveControlTab
                    GUISetState(@SW_HIDE, $hChildGUI)
                    GUISetState(@SW_SHOW, $hChildGUI2)
                Case Else
                    GUISetState(@SW_HIDE, $hChildGUI)
                    GUISetState(@SW_HIDE, $hChildGUI2)
                    _WinAPI_RedrawWindow($hGUI)
            EndSwitch
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Hi,

I while back I asked about the "Tab in Tab" situation, and was given the method of creating a child GUI to house the "tab in a tab". It works, except there is one problem: When you click another tab in the "parent" tab, the child GUI hides, yet no controls show where the child GUI was...here is my complete code:

..

Try clicking on the "Applications" tab. You'll see what I mean...

Make the parent of the child window $hGUI not $hParenttab.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  
Followers 0