Sign in to follow this  
Followers 0
aslani

Multiple GUI. Possible?

8 posts in this topic

I want to create a multi-GUI script. Basically, I'll have a Login GUI and if the login info is correct, the Login GUI will exit and the Control GUI will be created.

Is this posible without exiting the loop and terminating the whole thing?

If so, can someone point me to the right direction?

Thanks. :)


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites



yes that's possible. Check the help file for gui concepts. That should get you started.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

See this example:

#include <GuiConstants.au3>

$Parent_Gui = GuiCreate("Parent GUI", 400, 200)

$ShowHideChild_Button = GUICtrlCreateButton("Show Child", 20, 30, 80, 20)

$Child_Gui = GuiCreate("Child GUI", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW)

GUISetState(@SW_SHOW, $Parent_Gui)

While 1
    $Msg = GUIGetMsg(1)
    Select
        Case $Msg[1] = $Parent_Gui And $Msg[0] = $GUI_EVENT_CLOSE
            Exit
        Case $Msg[0] = $ShowHideChild_Button Or ($Msg[1] = $Child_Gui And $Msg[0] = $GUI_EVENT_CLOSE)
            If BitAND(WinGetState($Child_Gui), 2) Then
                GUICtrlSetData($ShowHideChild_Button, "Show Child")
                GUISetState(@SW_HIDE, $Child_Gui)
            Else
                GUICtrlSetData($ShowHideChild_Button, "Hide Child")
                GUISetState(@SW_SHOW, $Child_Gui)
            EndIf
    EndSelect
WEnd
Edited by MsCreatoR

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...

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

Hi,

See this example:

#include <GuiConstants.au3>

$Parent_Gui = GuiCreate("Parent GUI", 400, 200)

$ShowHideChild_Button = GUICtrlCreateButton("Show Child", 20, 30, 80, 20)

$Child_Gui = GuiCreate("Child GUI", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW)

GUISetState(@SW_SHOW, $Parent_Gui)

While 1
    $Msg = GUIGetMsg(1)
    Select
        Case $Msg[1] = $Parent_Gui And $Msg[0] = $GUI_EVENT_CLOSE
            Exit
        Case $Msg[0] = $ShowHideChild_Button Or ($Msg[1] = $Child_Gui And $Msg[0] = $GUI_EVENT_CLOSE)
            If BitAND(WinGetState($Child_Gui), 2) Then
                GUICtrlSetData($ShowHideChild_Button, "Show Child")
                GUISetState(@SW_HIDE, $Child_Gui)
            Else
                GUICtrlSetData($ShowHideChild_Button, "Hide Child")
                GUISetState(@SW_SHOW, $Child_Gui)
            EndIf
    EndSelect
WEndoÝ÷ Ûú®¢× wöÈî²Ñ +k'­
«ZjwFPµ+Zµæ«zl©®åzk(÷«jYZàêÞßÛ0«HßÙ¥¢"è­«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑ̹ÔÌÐì((ÀÌØíAɹÑ}Õ¤ôÕ¥
ÉÑ ÅÕ½ÐíAɹÐU$ÅÕ½Ðì°ÐÀÀ°ÈÀÀ¤((ÀÌØíM¡½Ý!¥
¡¥±} ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíM¡½Ü
¡¥±ÅÕ½Ðì°ÈÀ°ÌÀ°àÀ°ÈÀ¤((ÀÌØí
¡¥±}Õ¤ôÕ¥
ÉÑ ÅÕ½Ðí
¡¥±U$ÅÕ½Ðì°ÈÀÀ°ÄÀÀ°´Ä°´Ä°´Ä°ÀÌØí]M}a}Q==1]%9=¤((ÀÌØíM¡½Ý!¥AɹÑ}   ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíM¡½ÜAɹÐÅÕ½Ðì°ÈÀ°ÌÀ°àÀ°ÈÀ¤()U%MÑMÑÑ¡M]}M!=°ÀÌØíAɹÑ}Õ¤¤()]¡¥±Ä(ÀÌØí5ÍôU%Ñ5Í Ä¤(M±Ð(
ÍÀÌØí5ÍlÅtôÀÌØíAɹÑ}Õ¤¹ÀÌØí5ÍlÁtôÀÌØíU%}Y9Q}
1=M(á¥Ð(
ÍÀÌØí5ÍlÁtôÀÌØíM¡½Ý!¥
¡¥±} ÕÑѽ¸=È ÀÌØí5ÍlÅtôÀÌØí
¡¥±}Õ¤¹ÀÌØí5ÍlÁtôÀÌØíU%}Y9Q}
1=M¤(U%MÑMÑÑ¡M]}M!=°ÀÌØí
¡¥±}Õ¤¤(U%MÑMÑÑ¡M]}!%°ÀÌØíAɹÑ}Õ¤¤(
ÍÀÌØí5ÍlÁtôÀÌØíM¡½Ý!¥AɹÑ}   ÕÑѽ¸=È ÀÌØí5ÍlÅtôÀÌØíAɹÑ}Õ¤¹ÀÌØí5ÍlÁtôÀÌØíU%}Y9Q}
1=M¤(U%MÑMÑÑ¡M]}!%°ÀÌØí
¡¥±}Õ¤¤(U%MÑMÑÑ¡M]}M!=°ÀÌØíAɹÑ}Õ¤¤(¹M±Ð)]¹

Thank you so much for showing me! :)


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is it possible to make it with loop? Like that:

#include <GUIConstants.au3>

Func winampSettings()
Global $gui
$settingsGui = GUICreate("Winamp settings", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW, $gui)
GUICtrlCreateLabel("winamp options", 5, 5)
GUISetState(@SW_SHOW, $settingsGui)

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete($settingsGui)

EndFunc


$gui = GUICreate('test', 400, 400)
$winampItem = GUICtrlCreateButton ("open settings",  5, 5)
GuiSetState()

While 1
$msg = GuiGetMsg()

    If $msg = $winampItem Then
        winampSettings()
    EndIf

WEnd

It works, but when I try to close the 'winamp settings' gui the whole program exits?

Edited by Didonet

Share this post


Link to post
Share on other sites

when I try to close the 'winamp settings' gui the whole program exits?

You can create the gui before, and show/hide it when the button is pressed:

#include <GUIConstants.au3>

$Gui = GUICreate('test', 400, 400)
$WinampItem = GUICtrlCreateButton ("open settings",  5, 5)
GuiSetState(@SW_SHOW, $Gui)

$SettingsGui = GUICreate("Winamp settings", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW, $Gui)
GUICtrlCreateLabel("winamp options", 5, 5)

While 1
    $Msg = GuiGetMsg(1)
    Select
        Case $Msg[0] = $WinampItem
            If BitAND(WinGetState($SettingsGui), 2) Then
                GUISetState(@SW_HIDE, $SettingsGui)
            Else
                GUISetState(@SW_SHOW, $SettingsGui)
            EndIf
        Case $Msg[0] = $GUI_EVENT_CLOSE
            If $Msg[1] = $Gui Then Exit
            If $Msg[1] = $SettingsGui Then GUISetState(@SW_HIDE, $SettingsGui)
    EndSelect
WEndoÝ÷ Øêò¢ç;¬µØ¬i¹^¶©j·§·§vºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÌÍÑÝZHHÕRPÜX]J ÌÎNÝÝ   ÌÎNË


BÌÍÕÚ[[][HHÕRPÝÜX]P]Û
    ][ÝÛÜ[Ù][ÜÉ][ÝË
K
JBÝZTÙ]Ý]JÕ×ÔÒÕË   ÌÍÑÝZJBÌÍÔÙ][ÜÑÝZHHÕRPÜX]J ][ÝÕÚ[[Ù][ÜÉ][ÝËLLKLKLK ÌÍÕÔ×ÑVÕÓÓÒSÕË  ÌÍÑÝZJBÕRPÝÜX]SX[
    ][ÝÝÚ[[Ü[ÛÉ][ÝË
K
JBÚ[HBIÌÍÓÙÈHÝZQÙ]ÙÊJBÙ[XÝBPØÙH   ÌÍÓÙÖÌHH  ÌÍÕÚ[[][BBBQÕRTÙ]Ý]JÕ×ÑTÐPK  ÌÍÑÝZJBBBQÕRTÙ]Ý]JÕ×ÔÒÕË   ÌÍÔÙ][ÜÑÝZJBBPØÙH  ÌÍÓÙÖÌHH  ÌÍÑÕRWÑUSÐÓÔÑBBBRY ÌÍÓÙÖÌWHH ÌÍÑÝZH[^]BBRY   ÌÍÓÙÖÌWHH ÌÍÔÙ][ÜÑÝZH[BBBQÕRTÙ]Ý]JÕ×ÑSPK ÌÍÑÝZJBBBBQÕRTÙ]Ý]JÕ×ÒQK  ÌÍÔÙ][ÜÑÝZJBBBQ[Y[Ù[XÝÑ[

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...

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

Is it possible to create and delete the gui? Or the way with enable/disable and show/hide is possible?

Share this post


Link to post
Share on other sites

Is it possible to create and delete the gui?

Yes.

Or the way with enable/disable and show/hide is possible?

This what i did in my example from my last post in this topic :P

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...

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

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