Sign in to follow this  
Followers 0
leevy

gui problem - window from hide to show

5 posts in this topic

hello, I met a new problem. here is my script:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
_Main()

Func _Main()
    
Global $parent, $tabitem2
; Create the GUI window and controls
    $parent = GUICreate("xxxx", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)
    $OLD = _SetThemes(0)
    GUISetIcon("xxxx")

    $tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )
    _SetThemes($OLD)

    $tabitem1 = GUICtrlCreateTabItem("version")

    $tabitem2 = GUICtrlCreateTabItem("report")
    $radioAddreport = GUICtrlCreateRadio("Add reports", 25, 45, 160, 20, 000000)    
    $radioAddreporttemplate = GUICtrlCreateRadio("Add report template", 200, 45, 150, 20, 000000)
    $bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)
    $bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)   
    GUICtrlSetData($bugreporttemplate, "report1|template|data", "report1")
    GUICtrlCreateTabItem("readme")
    
    GUICtrlCreateTabItem("")
    $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)

    
; Run the GUI until it is closed
    GUISetState(@SW_SHOW, $parent)
            
    While 1

        $msg = GUIGetMsg()
            
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
                case $msg = $tab
                    if GUICtrlRead($tab) = 1 Then
                        $clickAddreport = ControlClick("Wing 1.0","",$radioAddreport)                       
                    EndIf
                case $msg = $radioAddreporttemplate
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_hide)
                    GUICtrlSetState($bugreporttemplate,$GUI_hide)
                    GUISetState(@SW_HIDE, $sub)
                case $msg = $radioAddreport
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_show)
                    GUICtrlSetState($bugreporttemplate,$GUI_show)
                Case $msg = $bugreporttemplate
                    GUIDelete($sub)
                    Local $reporttemplate = GUICtrlRead($bugreporttemplate)
                    if $reporttemplate = "template" Then
                        GUISwitch($parent, $tabitem2)
                        $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)
                        GUISetState(@SW_SHOW, $sub)
                        GUICtrlCreateInput("aaaa", 25, 60, 250, 20,0x0080)
                    Else
                        GUISwitch($parent, $tabitem2)
                        $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)
                        GUISetState(@SW_SHOW, $sub)
                        GUICtrlCreateInput("bbbb", 25, 60, 250, 20,0x0080)
                        GUICtrlCreateInput("cccc", 25, 90, 250, 20,0x0080)
                        
                    EndIf
            EndSelect
    WEnd

    Exit
EndFunc ;==>_Main

Func _SetThemes($Style)
    If @OSType = "WIN32_WINDOWS" Or $Style=-1 Then Return SetError(1,0,-1)
    Local $ret = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties")
    If Not IsArray($ret) Then Return SetError(1,0,-1)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $Style)
    Return $ret[0]
EndFunc

first, I select "data" item from Template in tab report, then I click radio button Add report template, at last, I click radio button Add reports, the question appears at this moment, the two inputbox "bbbb", "cccc" are missing, In fact, the sub window is missing. I hope the controls shown, how can I do it?

Share this post


Link to post
Share on other sites



leevy,

Look at this code snippet:

case $msg = $radioAddreporttemplate
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_hide)
                    GUICtrlSetState($bugreporttemplate,$GUI_hide)
                    GUISetState(@SW_HIDE, $sub) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

When you action $radioAddreporttemplate, you hide the sub-window. If you delete this line, your sub-window stays visible.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

leevy,

Look at this code snippet:

case $msg = $radioAddreporttemplate
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_hide)
                    GUICtrlSetState($bugreporttemplate,$GUI_hide)
                    GUISetState(@SW_HIDE, $sub); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

When you action $radioAddreporttemplate, you hide the sub-window. If you delete this line, your sub-window stays visible.

M23

Sorry, I must hide the sub window, because other controls will be shown when I click $radioAddreporttemplate.

Share this post


Link to post
Share on other sites

leevy,

Please set out the logic flow of what you want to do because I am now confused as to what exactly you want.

first, I select "data" item from Template in tab report, then I click radio button Add report template, at last, I click radio button Add reports, the question appears at this moment, the two inputbox "bbbb", "cccc" are missing, In fact, the sub window is missing. I hope the controls shown, how can I do it?

Sorry, I must hide the sub window, because other controls will be shown when I click $radioAddreporttemplate

Your input boxes are in the sub-window - if you hide the sub-window, you hide the input boxes. You cannot have it both ways!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

leevy,

Please set out the logic flow of what you want to do because I am now confused as to what exactly you want.

Your input boxes are in the sub-window - if you hide the sub-window, you hide the input boxes. You cannot have it both ways!

M23

Thanks M23, I know the reason now, I have not sorted out the logic flow, so I missed one step "GUISetState(@SW_SHOW, $sub)". Finally, thanks for the warning.

the final code is the following, I add "GUISetState(@SW_SHOW, $sub)" at line 49.

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
_Main()

Func _Main()
    
Global $parent, $tabitem2
; Create the GUI window and controls
    $parent = GUICreate("xxxx", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)
    $OLD = _SetThemes(0)
    GUISetIcon("xxxx")

    $tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )
    _SetThemes($OLD)

    $tabitem1 = GUICtrlCreateTabItem("version")

    $tabitem2 = GUICtrlCreateTabItem("report")
    $radioAddreport = GUICtrlCreateRadio("Add reports", 25, 45, 160, 20, 000000)    
    $radioAddreporttemplate = GUICtrlCreateRadio("Add report template", 200, 45, 150, 20, 000000)
    $bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)
    $bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)   
    GUICtrlSetData($bugreporttemplate, "report1|template|data", "report1")
    GUICtrlCreateTabItem("readme")
    
    GUICtrlCreateTabItem("")
    $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)

    
; Run the GUI until it is closed
    GUISetState(@SW_SHOW, $parent)
            
    While 1

        $msg = GUIGetMsg()
            
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
                case $msg = $tab
                    if GUICtrlRead($tab) = 1 Then
                        $clickAddreport = ControlClick("Wing 1.0","",$radioAddreport)                       
                    EndIf
                case $msg = $radioAddreporttemplate
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_hide)
                    GUICtrlSetState($bugreporttemplate,$GUI_hide)
                    GUISetState(@SW_HIDE, $sub)
                case $msg = $radioAddreport
                    GUISetState(@SW_SHOW, $sub) ; the new added
                    GUICtrlSetState($bugreporttemplatelabel,$GUI_show)
                    GUICtrlSetState($bugreporttemplate,$GUI_show)
                Case $msg = $bugreporttemplate
                    GUIDelete($sub)
                    Local $reporttemplate = GUICtrlRead($bugreporttemplate)
                    if $reporttemplate = "template" Then
                        GUISwitch($parent, $tabitem2)
                        $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)
                        GUISetState(@SW_SHOW, $sub)
                        GUICtrlCreateInput("aaaa", 25, 60, 250, 20,0x0080)
                    Else
                        GUISwitch($parent, $tabitem2)
                        $sub = GUICreate("", 370, 340, (@DesktopWidth - 1000)/ 2, (@DesktopHeight - 500) / 2, $WS_POPUP + $WS_VSCROLL, $WS_EX_MDICHILD, $parent)
                        GUISetState(@SW_SHOW, $sub)
                        GUICtrlCreateInput("bbbb", 25, 60, 250, 20,0x0080)
                        GUICtrlCreateInput("cccc", 25, 90, 250, 20,0x0080)
                        
                    EndIf
            EndSelect
    WEnd

    Exit
EndFunc;==>_Main

Func _SetThemes($Style)
    If @OSType = "WIN32_WINDOWS" Or $Style=-1 Then Return SetError(1,0,-1)
    Local $ret = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties")
    If Not IsArray($ret) Then Return SetError(1,0,-1)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $Style)
    Return $ret[0]
EndFunc

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