Jump to content

Several GUI in one script


Doxie
 Share

Recommended Posts

Hi,

I know this is in the help file, but i can't get it to work?

Scite is not recognize the Parent/Child.

I create a GUI, with several CreateMenu.

Some of the Menuitems should open new GUI (childs) but how :lmao:

I thought it was simple as:

GUICreate("Title",450,300, parent)

GUICreate("Title",250,250, child)

How many child windows can i have open at once?

Or how many child can i have in my script?

Thanks in advance

Were ever i lay my script is my home...

Link to comment
Share on other sites

A bit of a hack on an existing script. But may show you some hiding and showing of gui windows?

#include <GUIConstants.au3>
Opt("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 4)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250

$ParentWin = GUICreate("Parent GUI", $GUIWidth, $GUIHeight)
$ParentWin_Pos = WinGetPos("handle=" & $ParentWin, "")
$menu1 = GUICtrlCreateMenu('File')
$menu2 = GUICtrlCreateMenuItem('Child', $menu1)
$ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $ParentWin)
GUISetState(@SW_HIDE)

GUISwitch($ParentWin)
GUISetState(@SW_SHOW)

While 1
    Sleep(25)
    $msg = GUIGetMsg(1)
    Select
        
        Case $msg[0] = $GUI_EVENT_CLOSE
            If $msg[1] = $ParentWin Then
                MsgBox(64, "Test", "Parent GUI will now close.")
                GUISwitch($ParentWin)
                GUIDelete()
                Exit
            ElseIf $msg[1] = $ChildWin Then
                GUISwitch($ChildWin)
                GUISetState(@SW_HIDE)
                GUISwitch($ParentWin)
            EndIf
            
        Case $msg[0] = $menu2  ;; Shows Child windows from Parent Menu
                GUISwitch($ChildWin)
                GUISetState(@SW_SHOW)
            
    EndSelect
    
WEnd

Link to comment
Share on other sites

This is my project, so far its only GUI, to get approvel.

I guess this will create alot of new threads in the support forum, since i'm not sure how to do everything yet.

PS. The child GUI should be used with Add, Edit and Delete App.

#include <GUIConstants.au3>

GUICreate("Application Launcher",450,300)
$Group_1 = GuiCtrlCreateGroup("Info", 10, 10, 160, 245)
$Group_2 = GuiCtrlCreateGroup("", 180, 10, 260, 245)
Global $defaultstatus = "Ready"
Global $status

$Combo_1 = GuiCtrlCreateCombo("1_AllZones", 190, 25, 220, 21)
GuiCtrlSetData(-1,"Amendments|IE6SP1|IE55|Off2kSP3|W2KPro SP1")
$Combo_2 = GuiCtrlCreateCombo("2_RegionalApplications", 190, 55, 220, 21)
GuiCtrlSetData(-1,"2kAdobeReader6_0|2KiWMPlayer_v90_R100|2kNotes5_10|2KSAV81|2KWinzip8_01")
$Combo_3 = GuiCtrlCreateCombo("3_Service Applications", 190, 85, 220, 21)
$Combo_4 = GuiCtrlCreateCombo("4_Business Global Applications", 190, 115, 220, 21)
$Combo_5 = GuiCtrlCreateCombo("5_Business Applications", 190, 145, 220, 21)
$Combo_5 = GuiCtrlCreateCombo("6_Special", 190, 175, 220, 21)
$Input_6 = GuiCtrlCreateInput("", 190, 205, 160, 20)
$Button_7 = GuiCtrlCreateButton("Browse", 360, 205, 50, 20)

$filemenu = GUICtrlCreateMenu ("&File")
$fileitem = GUICtrlCreateMenuitem ("Open IR",$filemenu)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$print = GUICtrlCreateMenu ("Print IR",$filemenu)
$print1 = GUICtrlCreateMenuitem ("Printer 1",$print)
$print2 = GUICtrlCreateMenuitem ("Printer 2",$print)
$print3 = GUICtrlCreateMenuitem ("Printer 3",$print)
$print4 = GUICtrlCreateMenuitem ("Printer 4",$print)
$print5 = GUICtrlCreateMenuitem ("Printer 5",$print)
$print6 = GUICtrlCreateMenuitem ("Printer 6",$print)
GUICtrlSetState(-1,$GUI_CHECKED)
$print7 = GUICtrlCreateMenuitem ("Printer 7",$print)
$appmenu = GUICtrlCreateMenu ("Application")
$additem = GUICtrlCreateMenu ("Add",$appmenu)
$add1 = GUICtrlCreateMenuitem ("Lvl 1",$additem)
$add2 = GUICtrlCreateMenuitem ("Lvl 2",$additem)
$add3 = GUICtrlCreateMenuitem ("Lvl 3",$additem)
$add4 = GUICtrlCreateMenuitem ("Lvl 4",$additem)
$add5 = GUICtrlCreateMenuitem ("Lvl 5",$additem)
$add6 = GUICtrlCreateMenuitem ("Medical",$additem)
$edititem = GUICtrlCreateMenuitem ("Edit",$appmenu)
$delitem = GUICtrlCreateMenuitem ("Del",$appmenu)

$helpmenu = GUICtrlCreateMenu ("Help")
;$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
;GUICtrlSetState(-1,$GUI_DISABLE)
$helpitem = GUICtrlCreateMenuitem ("Help            F1",$helpmenu)
$infoitem = GUICtrlCreateMenuitem ("About Launcher",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)

$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2)  ; create a separator line

;$viewmenu = GUICtrlCreateMenu("View",-1,1)  ; is created before "?" menu
;$viewstatusitem = GUICtrlCreateMenuitem ("Statusbar",$viewmenu)
GUICtrlSetState(-1,$GUI_CHECKED)
$okbutton = GUICtrlCreateButton ("Install",190,230,70,20)
GUICtrlSetState(-1,$GUI_FOCUS)
$cancelbutton = GUICtrlCreateButton ("Cancel",270,230,70,20)

$statuslabel = GUICtrlCreateLabel ($defaultstatus,0,260,500,16,BitOr($SS_SIMPLE,$SS_SUNKEN))

GUISetState ()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $fileitem Then
        $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu)
    EndIf 
    If $msg = $button_7 Then
        $file1 = FileOpenDialog("Choose file...","::{20D04FE0-3AEA-1069-A2D8-08002B30309D}","All (*.*)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu)
    EndIf 

    If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then Msgbox(0,"About","Application Launcher BETA v. 0.1")
    If $msg = $add1 Then Add1()
    If $msg = $add2 Then Add2()
    If $msg = $add3 Then Add3()
    If $msg = $add4 Then Add4()
    If $msg = $add5 Then Add5()
    If $msg = $add6 Then Add6()
WEnd
Func Add1()
   Msgbox(0,"Add Application","Level 1")
EndFunc
Func Add2()
   Msgbox(0,"Add Application","Level 2")
EndFunc
Func Add3()
   Msgbox(0,"Add Application","Level 3")
EndFunc
Func Add4()
   Msgbox(0,"Add Application","Level 4")
EndFunc
Func Add5()
   Msgbox(0,"Add Application","Level 5")
EndFunc
Func Add6()
   Msgbox(0,"Add Application","Medical")
EndFunc
GUIDelete()

Exit
Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

That's a smart looking Gui. Should be great when done.

The limit for Gui's. Is a limit available? I would say plenty enough Guii? I think I just created a new word, Guii? Might be a french word?

:lmao:

<{POST_SNAPBACK}>

no Italian as the plural of scenario which is scenarii :">
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...