Jump to content
Sign in to follow this  
JavaScript_Freek

Make Two GUIS

Recommended Posts

JavaScript_Freek

Ok well how would I make it so I have a GUIWindow pop up with text input box then an ok button which goes to the next window?

Not INPUTBOX("title",blahlah) -no not that cause you can't style that with images.

#include <GUIConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <TabConstants.au3>



$name = InputBox("Log In", "Please enter your name:")


GUICreate("Urbanyx",400,400)
GUISetIcon("C:\Program\AutoIt3\beta\Icons\au3.ico", 0)
TrayTip("Welcome to Urbanyx", "You are now logged into urbanyx.", 5, 1)



; MENU
$filem = GUICtrlCreateMenu("File")
GuiCtrlCreateMenuitem ("",$filem)
$exititem2 = GUICtrlCreateMenuitem("Exit", $filem)
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem2 = GUICtrlCreateMenuitem("About", $helpmenu)

; ABOUT
$s_TempFile = _TempFile()
Inetget("http://i36.tinypic.com/2wlzq6e.gif",$s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 100)
GUICtrlSetState(-1, $GUI_DISABLE)

$label2 = GUICtrlCreateLabel($name, 290,28, 70, 14)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )

$tab = GUICtrlCreateTab(5, 105, 390, 100,$TCS_MULTILINE , $TCS_VERTICAL )

$tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("lasdasd", 30, 130, 50, 20)

    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label2", 30, 130, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlCreateLabel("label3", 30, 130, 50, 20)

    GUICtrlCreateTabItem("")   ; end tabitem definition

GuiSetState()

While 1
    $msg = GuiGetMsg()
    
    If $msg = $exititem2 Or $msg = -3 Or $msg = -1 Then ExitLoop
    If $msg = $aboutitem2 Then Msgbox(0,"About","Sample Menu coded by Dan http://sodadome.com")


WEnd

GUIDelete()

Exit

[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites
torels

just delete that gui and create a new one (?)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
MrCreatoR

Do you mean like wizard?

Here is a full example of wizard GUI:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Global $Img_Path = @SystemDir & "\Setup.bmp"

$Main_GUI = GUICreate("Wizard Demo!", 400, 300)

_GUICtrlCreateSeperator(0, 2, 265, 3, 396)

$Back_Button = GUICtrlCreateButton("<<Back", 170, 270, 60)
GUICtrlSetState(-1, $GUI_DISABLE)
$Next_Button = GUICtrlCreateButton("Next>>", 240, 270, 60)

$Exit_Button = GUICtrlCreateButton("Exit", 325, 270, 60)


$ChildGui_1 = GUICreate("Child window 1", 400, 260, 5, 5, $WS_POPUP)
$LabelGui1 = GUICtrlCreatePic($Img_Path, 2, 2, 160, 250, $SS_SUNKEN, $WS_EX_STATICEDGE+$WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Wellcome!", 240, 20, 150)
GUICtrlSetFont(-1, 12, 800)

$ChildGui_2 = GUICreate("Child window 2", 400, 260, 5, 5, $WS_POPUP)
$LabelGui2 = GUICtrlCreateInput("Some input", 10, 20, 180)

$ChildGui_3 = GUICreate("Child window 3", 400, 260, 5, 5, $WS_POPUP)
$LabelGui3 = GUICtrlCreateEdit("Some Edit", 10, 20, 180, 220)

DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_1, "hwnd", $Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_2, "hwnd", $Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_3, "hwnd", $Main_GUI)

GUISetState(@SW_SHOW, $Main_GUI)
GUISetState(@SW_SHOW, $ChildGui_1)

While 1
    $Msg = GUIGetMsg(1)
    
    Switch $Msg[0]
        Case $GUI_EVENT_CLOSE, $Exit_Button
            If $Msg[0] = $Exit_Button And Not _WinIsVisible($ChildGui_1) Then
                $Ask = MsgBox(256+52, "Attention", "Are you sure you want to exit the Wizard now?", 0, $Msg[1])
                If $Ask <> 6 Then ContinueLoop
            EndIf
            
            If $Msg[1] = $Main_GUI Then Exit
        Case $Next_Button
            GUICtrlSetState($Back_Button, $GUI_ENABLE)
            
            Local $CurrentHandle = 0
            Local $NextHandle = 0
            
            Select
                Case _WinIsVisible($ChildGui_1)
                    $CurrentHandle = $ChildGui_1
                    $NextHandle = $ChildGui_2
                Case _WinIsVisible($ChildGui_2)
                    $CurrentHandle = $ChildGui_2
                    $NextHandle = $ChildGui_3
                    GUICtrlSetState($Next_Button, $GUI_DISABLE)
            EndSelect
            
            If $CurrentHandle <> 0 Then
                GUISetState(@SW_HIDE, $CurrentHandle)
                GUISetState(@SW_SHOW, $NextHandle)
            EndIf
            
            WinActivate($Main_GUI)
        Case $Back_Button
            GUICtrlSetState($Next_Button, $GUI_ENABLE)
            
            Local $CurrentHandle = 0
            Local $BackHandle = 0
            
            Select
                Case _WinIsVisible($ChildGui_3)
                    $CurrentHandle = $ChildGui_3
                    $BackHandle = $ChildGui_2
                Case _WinIsVisible($ChildGui_2)
                    $CurrentHandle = $ChildGui_2
                    $BackHandle = $ChildGui_1
                    GUICtrlSetState($Back_Button, $GUI_DISABLE)
            EndSelect
            
            If $CurrentHandle <> 0 Then
                GUISetState(@SW_HIDE, $CurrentHandle)
                GUISetState(@SW_SHOW, $BackHandle)
            EndIf
            
            WinActivate($Main_GUI)
    EndSwitch
WEnd

Func _GUICtrlCreateSeperator($Direction, $Left, $Top, $Width=3, $Lenght=25)
    Switch $Direction
        Case 0
            GUICtrlCreateLabel("", $Left, $Top, $Lenght, $Width, $SS_SUNKEN)
        Case 1
            GUICtrlCreateLabel("", $Left, $Top, $Width, $Lenght, $SS_SUNKEN)
    EndSwitch
EndFunc

Func _WinIsVisible($hWnd)
    Return BitAND(WinGetState($hWnd), 2)
EndFuncoÝ÷ Ø Ý¶¬¢w¢²È¦¦WÅ©©çè­ÊÞjاÜ(è°whÂÃÚ­éíСWZºÚ"µÍÚ[ÛYH    ÑÕRPÛÛÝ[Ñ^]LÉÝÂ[H  ÌÍÚÕRLK ÌÍÚÕRL  ÌÍÐ]ÛÌÍÚÕRLHHÕRPÜX]J  ][ÝÕ]LI][ÝËL
BÌÍÐ]ÛHÕRPÝÜX]P]Û   ][ÝÓÒÉ][ÝË

BÕRTÙ]Ý]J
BÚ[HBIÌÍÛÙÈHÕRQÙ]ÙÊJBTÝÚ]Ú ÌÍÛÙÖÌBBPØÙHLÂBBRY ÌÍÛÙÖÌWHH ÌÍÚÕRLH[^]BBBBBQÕRTÙ]Ý]JÕ×ÑSPK    ÌÍÚÕRLJBBBQÕRQ[]J  ÌÍÚÕRLBBPØÙH  ÌÍÐ]ÛBBQÕRTÙ]Ý]JÕ×ÑTÐPK  ÌÍÚÕRLJBBBIÌÍÚÕRLHÕRPÜX]J ][ÝÕ]L][ÝËMLLKLKLKLK    ÌÍÚÕRLJBBBBBBQÕRTÙ]Ý]J
BQ[ÝÚ]ÚÑ[

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
JavaScript_Freek

I mean I want one box opens with text input then you click ok and it goes to my sample menu.


[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites
MrCreatoR

one box opens with text input then you click ok and it goes to my sample menu

What goes to the menu? and how it should be in the menu? ;)

When you use inputbox just hold it in the variable, and you can do with it whatever you need later...


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
JavaScript_Freek

This is what goes in my menu.

#include <GUIConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <TabConstants.au3>



$name = InputBox("Log In", "Please enter your name:")


GUICreate("Urbanyx",400,400)
GUISetIcon("C:\Program\AutoIt3\beta\Icons\au3.ico", 0)
TrayTip("Welcome to Urbanyx", "You are now logged into urbanyx.", 5, 1)



; MENU
$filem = GUICtrlCreateMenu("File")
GuiCtrlCreateMenuitem ("",$filem)
$exititem2 = GUICtrlCreateMenuitem("Exit", $filem)
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem2 = GUICtrlCreateMenuitem("About", $helpmenu)

; ABOUT
$s_TempFile = _TempFile()
Inetget("http://i36.tinypic.com/2wlzq6e.gif",$s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 100)
GUICtrlSetState(-1, $GUI_DISABLE)

$label2 = GUICtrlCreateLabel($name, 290,28, 70, 14)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )

$tab = GUICtrlCreateTab(5, 105, 390, 100,$TCS_MULTILINE , $TCS_VERTICAL )

$tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("lasdasd", 30, 130, 50, 20)

    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label2", 30, 130, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlCreateLabel("label3", 30, 130, 50, 20)

    GUICtrlCreateTabItem("")   ; end tabitem definition

GuiSetState()

While 1
    $msg = GuiGetMsg()
    
    If $msg = $exititem2 Or $msg = -3 Or $msg = -1 Then ExitLoop
    If $msg = $aboutitem2 Then Msgbox(0,"About","Sample Menu coded by Dan http://sodadome.com")


WEnd

GUIDelete()

Exit

[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites
AoRaToS

Try this...

The Ok button could also just call the Main function and you can GUIDelete the firstGUI in the Main,or you could just use One function to do it all...

#include <GUIConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <TabConstants.au3>
#include <EditConstants.au3>

Opt("GUIOnEventMode",1)

Global $GUI, $name

FirstGUI()

;--------------- Functions ---------------
Func FirstGUI()
    $GUI = GUICreate("", 165, 80)
    $name = GUICtrlCreateLabel("Username:", 5, 5)
    GUICtrlCreateInput("", 60, 5, 100, 20)
    $pass = GUICtrlCreateLabel("Password:", 5, 30, Default, Default, $ES_PASSWORD)
    GUICtrlCreateInput("", 60, 30, 100, 20)
    $Okbutton = GUICtrlCreateButton("OK",55,55,50,20)
    GUICtrlSetOnEvent($Okbutton,"Okbutton")
    GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")
    GUISetBkColor(0xe9e9e9)
    GUISetState(@SW_SHOW)
    While 1
        Sleep(100)
    WEnd
EndFunc

Func OkButton()
GUIDelete($GUI)
Call("Main")
EndFunc

Func OnExit()
Exit
EndFunc

Func Main()
GUICreate("Urbanyx",400,400)
GUISetIcon("C:\Program\AutoIt3\beta\Icons\au3.ico", 0)
TrayTip("Welcome to Urbanyx", "You are now logged into urbanyx.", 5, 1)
   
   
   
   ; MENU
   $filem = GUICtrlCreateMenu("File")
   GuiCtrlCreateMenuitem ("",$filem)
   $exititem2 = GUICtrlCreateMenuitem("Exit", $filem)
   $helpmenu = GUICtrlCreateMenu("About")
   $aboutitem2 = GUICtrlCreateMenuitem("About", $helpmenu)
   
   ; ABOUT
   $s_TempFile = _TempFile()
   Inetget("http://i36.tinypic.com/2wlzq6e.gif",$s_TempFile)
   GUICtrlCreatePic($s_TempFile, 0, 0, 400, 100)
   GUICtrlSetState(-1, $GUI_DISABLE)
   
   $label2 = GUICtrlCreateLabel($name, 290,28, 70, 14)
   GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )
   
   $tab = GUICtrlCreateTab(5, 105, 390, 100,$TCS_MULTILINE , $TCS_VERTICAL )
   
   $tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("lasdasd", 30, 130, 50, 20)
   
    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label2", 30, 130, 50, 20)
   
    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlCreateLabel("label3", 30, 130, 50, 20)
   
    GUICtrlCreateTabItem("")   ; end tabitem definition
   
   GuiSetState()
   
   While 1
    $msg = GuiGetMsg()
   
    If $msg = $exititem2 Or $msg = -3 Or $msg = -1 Then ExitLoop
    If $msg = $aboutitem2 Then Msgbox(0,"About","Sample Menu coded by Dan http://sodadome.com")
   
   
   WEnd
   
   GUIDelete()
   
   Exit
EndFunc

s!mpL3 LAN Messenger

Current version 2.9.8.8 [30/09/2015]

Download Here

s!mpL3

Share this post


Link to post
Share on other sites
enaiman

Try to understand what I did here.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <TabConstants.au3>


Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 219, 208, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Input1 = GUICtrlCreateInput("Input1", 32, 133, 153, 21)
$Label1 = GUICtrlCreateLabel("UserName", 32, 112, 54, 17)
$Button1 = GUICtrlCreateButton("I'm Lazy", 56, 168, 97, 25, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
$Icon1 = GUICtrlCreateIcon("", 0, 72, 32, 81, 65, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetImage(-1, "shell32.dll", 23, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $name

While 1
    Sleep(100)
WEnd

Func Button1Click()
    $name = GUICtrlRead($Input1)
    GUIDelete($Form1)
    _MainGUI()
EndFunc

Func Form1Close()
    Exit
EndFunc

Func _MainGUI()
    $NewGUI = GUICreate("Urbanyx",400,400)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    GUISetIcon("C:\Program\AutoIt3\beta\Icons\au3.ico", 0)
    TrayTip("Welcome to Urbanyx", "You are now logged into urbanyx.", 5, 1)

    ; MENU
    $filem = GUICtrlCreateMenu("File")
    GuiCtrlCreateMenuitem ("",$filem)
    $exititem2 = GUICtrlCreateMenuitem("Exit", $filem)
    GUICtrlSetOnEvent(-1, "Form1Close")
    $helpmenu = GUICtrlCreateMenu("About")
    $aboutitem2 = GUICtrlCreateMenuitem("About", $helpmenu)
    GUICtrlSetOnEvent(-1, "About")
    ; ABOUT
    $s_TempFile = _TempFile()
    Inetget("http://i36.tinypic.com/2wlzq6e.gif",$s_TempFile)
    GUICtrlCreatePic($s_TempFile, 0, 0, 400, 100)
    GUICtrlSetState(-1, $GUI_DISABLE)

    $label2 = GUICtrlCreateLabel($name, 290,28, 70, 14)
    GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )

    $tab = GUICtrlCreateTab(5, 105, 390, 100,$TCS_MULTILINE , $TCS_VERTICAL )

    $tab0 = GUICtrlCreateTabItem("tab0")
        GUICtrlCreateLabel("lasdasd", 30, 130, 50, 20)

        $tab1 = GUICtrlCreateTabItem("tab----1")
        GUICtrlCreateLabel("label2", 30, 130, 50, 20)

        $tab2 = GUICtrlCreateTabItem("tab2")
        GUICtrlCreateLabel("label3", 30, 130, 50, 20)

        GUICtrlCreateTabItem("")   ; end tabitem definition

    GuiSetState()
EndFunc

Func About()
    MsgBox(0, "About", "This is all about me.")
EndFunc

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
AoRaToS

The File->Exit won't work.And I only want USERNAME.

You haven't assigned some function to the file exit in your example that's why it doesn't work and you can just erase the password part ;)


s!mpL3 LAN Messenger

Current version 2.9.8.8 [30/09/2015]

Download Here

s!mpL3

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.