Sign in to follow this  
Followers 0
sw00n

Create Sub Gui

5 posts in this topic

#1 ·  Posted (edited)

ok i have:

Func shaders()
GUICreate("Common Textures List", 500, 210, 269, 216)
$Home1 = GUICtrlCreateMenu("Home")
GUISetState(@SW_SHOW)
endfunc
And it works great, but it actually opens another GUI beside it...

Is there another way to make it open within itself without making another new window in the start bar?

full code:

#include <GUIConstantsEx.au3>
#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolBar.au3>
#include <StaticConstants.au3>

GUICreate("1up Shader Maker.v1", 500, 210, 269, 216)
$input1 = GUICtrlCreateInput("", 7, 39, 150, 20)
$label1 = GUICtrlCreateLabel("Enter Your Texture Path below", 6, 17, 250, 15)
$menu1 = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open", $menu1)
$save = GUICtrlCreateMenuItem("Save As", $menu1)
$exit = GUICtrlCreateMenuItem("Exit", $menu1)
$help1 = GUICtrlCreateMenu("Help")
$help = GUICtrlCreateMenuItem("Help", $help1)
$edit = GUICtrlCreateEdit("", 200, 10, 270, 150)
$common = GUICtrlCreateMenu("Common")
$shaders = GUICtrlCreateMenuItem("Common Shaders", $common)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exit
            exit1()
        Case $help
            help()
        Case $open
            open1()
        Case $save
            save()
        Case $shaders
            shaders()
        EndSwitch
WEnd

Func help()
    MsgBox(0, "", "Enter the path or your texture, default is: textures/Name Here/Name Here")
EndFunc   ;==>help

Func exit1()
    MsgBox(0, "Exiting", "Now Exiting...")
    Exit
EndFunc   ;==>exit1

Func open1()
    $message = ("Only Open Shaders and Text Files")
    $var = FileOpenDialog($message, @ScriptDir & "\", "List (*.shader)")
    $file = FileRead($var)
    If @error Then
        MsgBox(0, "", "No File(s) were selected")
    Else
        GUICtrlSetData($edit, $file)
    EndIf
EndFunc   ;==>open1

Func save()

    $file = FileSaveDialog("Save Active Proxies", @ScriptDir, "Text Files (.shader)|All Files (*.*)", 18, "ShaderMv1.shader")
    $xFile = FileOpen($file, 8 + 2)
    FileWrite($xFile, GUICtrlRead($Input1))

EndFunc

Func shaders()
GUICreate("Common Textures List", 500, 210, 269, 216)
$Home1 = GUICtrlCreateMenu("Home")
GUISetState(@SW_SHOW)
endfunc
Edited by sw00n

Share this post


Link to post
Share on other sites



Hi sw00n,

please try this:

#include <GUIConstantsEx.au3>
#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolBar.au3>
#include <StaticConstants.au3>

$parent = GUICreate("1up Shader Maker.v1", 500, 210, 269, 216)
$input1 = GUICtrlCreateInput("", 7, 39, 150, 20)
$label1 = GUICtrlCreateLabel("Enter Your Texture Path below", 6, 17, 250, 15)
$menu1 = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open", $menu1)
$save = GUICtrlCreateMenuItem("Save As", $menu1)
$exit = GUICtrlCreateMenuItem("Exit", $menu1)
$help1 = GUICtrlCreateMenu("Help")
$help = GUICtrlCreateMenuItem("Help", $help1)
$edit = GUICtrlCreateEdit("", 200, 10, 270, 150)
$common = GUICtrlCreateMenu("Common")
$shaders = GUICtrlCreateMenuItem("Common Shaders", $common)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exit
            exit1()
        Case $help
            help()
        Case $open
            open1()
        Case $save
            save()
        Case $shaders
            shaders($parent)
        EndSwitch
WEnd

Func help()
    MsgBox(0, "", "Enter the path or your texture, default is: textures/Name Here/Name Here")
EndFunc   ;==>help

Func exit1()
    MsgBox(0, "Exiting", "Now Exiting...")
    Exit
EndFunc   ;==>exit1

Func open1()
    $message = ("Only Open Shaders and Text Files")
    $var = FileOpenDialog($message, @ScriptDir & "\", "List (*.shader)")
    $file = FileRead($var)
    If @error Then
        MsgBox(0, "", "No File(s) were selected")
    Else
        GUICtrlSetData($edit, $file)
    EndIf
EndFunc   ;==>open1

Func save()

    $file = FileSaveDialog("Save Active Proxies", @ScriptDir, "Text Files (.shader)|All Files (*.*)", 18, "ShaderMv1.shader")
    $xFile = FileOpen($file, 8 + 2)
    FileWrite($xFile, GUICtrlRead($Input1))

EndFunc

Func shaders($parent)
GUICreate("Common Textures List", 500, 210, 269, 216,-1,-1,$parent)
$Home1 = GUICtrlCreateMenu("Home")
GUISetState(@SW_SHOW)
endfunc

Made liite changes to the line where you create your first GUI, to the function call of "shaders" and to the shaders function including the GUI Create there.

You can assign a parent GUI to a new GUI.

Regards,

Hannes

:graduated:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Thank you so much for you help, i appreciate it :graduated:

Share this post


Link to post
Share on other sites

sw00n,

Now you are using multiple GUIs, could I recommend the Managing Multiple GUIs tutorial in the Wiki. It might save you a lot of frustration! :graduated:

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

Just got done reading the tutorial, thank you for recommending that..

Now i have a better understanding on how to manage multiple GUIs :graduated:

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