Sign in to follow this  
Followers 0
ChrisL

A little help with child windows please

3 posts in this topic

#1 ·  Posted (edited)

OK, I have a Gui, and on clicking a select button this opens up a second smaller Gui, however I can still see controls from the main gui over the top of the child gui, How do I make the child gui on top of all the main gui controls and dissable the main gui while the second gui is open..

Should it be a child or not?

Thanks in advance

#include <GuiConstants.au3>
#include <File.au3>


;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

$Main = GUICreate("MyGUI", 796, 568, (@DesktopWidth - 796) / 2, (@DesktopHeight - 568) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GUICtrlCreateGroup("Group1", 420, 10, 360, 540)
$Edit_2 = GUICtrlCreateEdit("", 80, 150, 300, 400)
$Combo_3 = GUICtrlCreateCombo("", 80, 60, 300, 121)
GUICtrlSetData(-1, " |<time>|<date>|<media>|<service>|<order>|<sheets>|<index>|<firstname>|<surname>|<email>|<phone>|<items>|<totals>|<prices>|<userinfo>|<creditcard>|<returndate>|<storehours>|<left>|<center>|<centre>|<right>|<newline>|<barcode>|")
$Input_4 = GUICtrlCreateInput("", 80, 100, 280, 20)
$OK_Button = GUICtrlCreateButton("OK", 380, 100, 30, 20)
$image_Button = GUICtrlCreateButton("Graphic", 20, 20, 40, 20)




GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $OK_Button
            $Command = GUICtrlRead($Combo_3)
            $String = GUICtrlRead($Input_4)
            $output = GUICtrlRead($Edit_2) & @CRLF & $Command & $String
            GUICtrlSetData($Edit_2, $output)
        Case $msg = $image_Button
    ;Greate second Gui to select image file [b]PROBLEM AREA!![/b]
            
    ;GUISetState(@SW_DISABLE,$Main)
            $Sub = GUICreate("Receipt Graphics", 200, 300, 1, 1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_Child + $DS_SETFOREGROUND, "",$Main)
            $SubList = GUICtrlCreateList("", 10, 10, 180, 200, BitOR($WS_BORDER, $WS_VSCROLL))
            GUICtrlSetData(-1, findreceiptbmp())
            $SubSelect = GUICtrlCreateButton("Select", 130, 230, 60, 20)
            GUISetState()
            While 1
                $msg2 = GUIGetMsg()
                Select
                    Case $msg2 = $GUI_EVENT_CLOSE
                        GUIDelete($Sub)
                        GUISetState(@SW_ENABLE, $Main)
                        ExitLoop
                    Case $msg2 = $SubSelect
                        
                        $data = "<image:" & GUICtrlRead($SubList) & ">"
                        $output = GUICtrlRead($Edit_2) & @CRLF & $data
                        GUICtrlSetData($Edit_2, $output)
                        GUIDelete($Sub)
                        GUISetState(@SW_ENABLE, $Main)
                        ExitLoop
                    Case Else
                ;;;
                EndSelect
            WEnd
            
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Func findreceiptbmp()
    Local $Filelist
    $fileHandle = FileFindFirstFile("D:\kiosk\Bitmaps\System\graphreceipt\" & "*.bmp")
    if (@error = 1) Then Return
    
    while (1)
        $file = FileFindNextFile($fileHandle)
        if (@error = 1) Then ExitLoop
        if ($file = "." Or $file = "..") Then ContinueLoop
        
        $Filelist = $Filelist & "|" & $file
        
    WEnd
    
    FileClose($fileHandle)
    Return $Filelist
EndFunc ;==>findreceiptbmp
Edited by ChrisL

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

heres a templet that i use for child windows that i have gotten help with from people here. it puts the child ontop of the first window and you cant use the main window untill the child is closed. might be what u are looking for

#include <GuiConstants.au3>
dim $intWindow
DisplayGUI()
Func DisplayGUI()
    
    Local $intWindow
    Local $intBtnExit
    Local $intMsg
    Local $intBtnchild
    
    $intWindow = GUICreate("script", 500, 180)
    
    $intBtnchild = GUICtrlCreateButton("Child", 100, 130, 70, 30)
    $intBtnExit = GUICtrlCreateButton("Exit", 385, 130, 70, 30)
    
    
    GUISetState()
    While 1
        $intMsg = GUIGetMsg()
        Select
            Case $intMsg = $GUI_EVENT_CLOSE Or $intMsg = $intBtnExit
                ExitLoop
            Case $intMsg = $intBtnchild
                child()
        EndSelect
    WEnd
    GUIDelete($intWindow)
EndFunc

Func child()
    $delwindow = GUICreate("Child Window", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), -1, $intWindow)
    $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30)

    GUISetState(@SW_SHOW)
    While 2
        $msg2 = GUIGetMsg()
        Select
        Case $msg2 = $DelBtnExit
            GUIDelete($delwindow)
            Return
            
        EndSelect
    WEnd
    Exit
EndFunc

EDIT: took out #include <Process.au3>, not sure why that was still in there

Edited by Zithen

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