Jump to content
Sign in to follow this  
PreludeOfDeath

Looping the GUI... :(

Recommended Posts

PreludeOfDeath

So when I click 'Add Account' it runs my AddAccountGUI right?

When I click 'SAVE' in my AddAccountGUI, it closes, and goes back to the MainGUI (Which never disappears)...

Now I want to click on another function (like 'Add Account' again)

How do I reactivate or keep the 'WHILE' active?

Please Help. Thank You!

Func CreateMainGUI()
    #Region ### START Koda GUI section ### Form=c:\documents and settings\matt\my documents\prelude\autoit scripts\character selector\koda forms\mainmenu.kxf
    $mainMenu = GUICreate("Character Selector", 632, 487, 188, 115)
    $nextButton = GUICtrlCreateButton("(Not allowed)", 584, 432, 35, 30, $BS_BITMAP)
    GUICtrlSetImage($nextButton, "C:\Documents and Settings\Matt\My Documents\Prelude\Autoit Scripts\Character Selector\NextButton.bmp")
    $backButton = GUICtrlCreateButton("(Not allowed)", 8, 432, 35, 30, $BS_BITMAP)
    GUICtrlSetImage($backButton, "C:\Documents and Settings\Matt\My Documents\Prelude\Autoit Scripts\Character Selector\BackButton.bmp")
    $groupChar1 = GUICtrlCreateGroup($charName1, 8, 8, 241, 115)
    $labelCharPic1 = GUICtrlCreatePic("C:\Documents and Settings\Matt\My Documents\Prelude\Autoit Scripts\Character Selector\PreludeOfDeath.jpg", 16, 24, 60, 90, BitOR($SS_NOTIFY,$WS_GROUP))
    $labelCharName1 = GUICtrlCreateLabel("Character: "&$charName1, 80, 24, 160, 17)
    $labelCharAcct1 = GUICtrlCreateLabel("Account: "&$charAcct1, 96, 40, 150, 17)
    $labelCharClass1 = GUICtrlCreateLabel("Class: "&$charClass1, 80, 56, 79, 17)
    $labelCharSlot1 = GUICtrlCreateLabel("Slot: "&$charSlot1, 210, 56, 30, 17)
    $labelCharType1 = GUICtrlCreateLabel("Type: "&$charType1, 80, 72, 120, 17)
    $labelCharLevel1 = GUICtrlCreateLabel("Level: "&$charLevel1, 195, 72, 50, 17)
    $labelCharNotes1 = GUICtrlCreateLabel("Notes: "&$charNotes1, 80, 88, 164, 33)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $file = GUICtrlCreateMenu("&File")
    $saveAll = GUICtrlCreateMenuItem("&Save All Changes", $file)
    $exit = GUICtrlCreateMenuItem("E&xit", $file)
    $add = GUICtrlCreateMenu("&Add")
    $addAcct = GUICtrlCreateMenuItem("Add &Account", $add)
    $addChar = GUICtrlCreateMenuItem("Add &Character", $add)
    $edit = GUICtrlCreateMenu("&Edit")
    $editAcct = GUICtrlCreateMenuItem("Edit &Account", $edit)
    $editChar = GUICtrlCreateMenuItem("Edit &Character", $edit)
    $delete = GUICtrlCreateMenu("&Delete")
    $deleteAcct = GUICtrlCreateMenuItem("Delete &Account", $delete)
    $deleteChar = GUICtrlCreateMenuItem("Delete &Character", $delete)
    $deleteAll = GUICtrlCreateMenuItem("&Delete All", $delete)
    $sortChar = GUICtrlCreateMenu("&Sort Characters")
    $settings = GUICtrlCreateMenu("Se&ttings")
    $settingsD2 = GUICtrlCreateMenuItem("&Diablo II Settings", $settings)
    $settingsPath = GUICtrlCreateMenuItem("&Path Settings", $settings)
    $run = GUICtrlCreateMenu("&Run")
    $runMH = GUICtrlCreateMenuItem("&MapHack", $run)
    $runRedvex = GUICtrlCreateMenuItem("&RedVex", $run)
    $runBluevex = GUICtrlCreateMenuItem("&BlueVex", $run)
    $about = GUICtrlCreateMenu("A&bout")
    $aboutSub = GUICtrlCreateMenuItem("&About", $about)
    $aboutContact = GUICtrlCreateMenuItem("&Contact", $about)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###


    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $exit
                Exit
            Case $addAcct
                CreateAddAccountGUI()
            Case $addChar
                CreateAddCharacterGUI()
            Case $editAcct
                CreateEditAccountGUI()
            Case $editChar
                CreateEditCharacterGUI()
            Case $deleteAcct
                CreateDeleteAccountGUI()
            Case $deleteChar
                CreateDeleteCharacterGUI()
            Case $deleteAll
                DeleteAll()
            Case $labelCharPic1, $labelCharName1, $labelCharAcct1, $labelCharClass1, $labelCharType1, $labelCharSlot1, $labelCharLevel1, $labelCharNotes1
                MsgBox(0,"a", "a")
        EndSwitch
    WEnd
EndFunc

EDIT:

Deleted my New post, figured that out <_<

Edited by PreludeOfDeath

Share this post


Link to post
Share on other sites
PreludeOfDeath

Yey, another problem!

I have 2 combo boxes...

One box has predefined values

The other has values that are based on what is selected on the first one.

So If i select 'Peanut Butter' on the first one, the second one displays 'Jelly' and 'Honey'

But if i select 'Turkey' on the first one, the second one displays 'Mayo' and 'Lettuce'

(Those are just Examples BTW)

I cant get the 2nd one to update when they select the first one...

I figured i could do this:

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $nMsg = $charType
                                                                If $charType = GUICtrlRead($charClass) = "Peanut Butter" Then
                    GUICtrlSetData($charType, "Jelly|Honey|Other")

But that doesnt seem to work...

Is there something else that I need to do?

Plz Help! Thank You for putting up with me! <_<

Share this post


Link to post
Share on other sites
Nahuel

Something like this I suppose:

#include <GUIConstants.au3>

GUICreate("Form1", 208, 97, 231, 172)
$Combo1 = GUICtrlCreateCombo("Peanut Butter", 18, 16, 173, 125)
GUICtrlSetData(-1,"Turkey","Peanut Butter")
$Combo2 = GUICtrlCreateCombo("", 18, 54, 173, 125)
GUICtrlSetData(-1,"Jelly|Honey","Jelly")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            $Type=GUICtrlRead($Combo1)
            Switch $Type
                Case "Peanut Butter"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Jelly|Honey","Jelly")
                Case "Turkey"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Mayo|Lettuce","Mayo")
            EndSwitch           
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
DirtDBaK

Something like this I suppose:

#include <GUIConstants.au3>

GUICreate("Form1", 208, 97, 231, 172)
$Combo1 = GUICtrlCreateCombo("Peanut Butter", 18, 16, 173, 125)
GUICtrlSetData(-1,"Turkey","Peanut Butter")
$Combo2 = GUICtrlCreateCombo("", 18, 54, 173, 125)
GUICtrlSetData(-1,"Jelly|Honey","Jelly")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            $Type=GuiCtrlRead(GUICtrlRead($Combo1))
            Switch $Type
                Case "Peanut Butter"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Jelly|Honey","Jelly")
                Case "Turkey"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Mayo|Lettuce","Mayo")
            EndSwitch         
    EndSwitch
WEnd

That may work all i changed was GuiCtrlRead( $Combo1) to GuiCtrlRead(GUICtrlRead($Combo1))

Sometimes you have to call the ctrl read function like that, ex. Listview


[center][/center]

Share this post


Link to post
Share on other sites
Nahuel

That may work all i changed was GuiCtrlRead( $Combo1) to GuiCtrlRead(GUICtrlRead($Combo1))

Sometimes you have to call the ctrl read function like that, ex. Listview

What? That doesn't work dude <_< The one I posted works just fine. GuiCtrlRead($Combo1) will return a string: either "Peanut butter" or "Turkey", so you say this is right?:

GuiCtrlRead("Peanut Butter")

Share this post


Link to post
Share on other sites
smashly

hat may work all i changed was GuiCtrlRead( $Combo1) to GuiCtrlRead(GUICtrlRead($Combo1))

Sometimes you have to call the ctrl read function like that, ex. Listview

That isn't needed..

When you do GuiCtrlRead(GuiCtrlRead($Listview), 1) would be because :

GuiCtrlRead($Listview) would return the (controlID) of the selected ListViewItem

GuiCtrlRead(GuiCtrlRead($Listview)) would return the State of the TreeViewItem..

GuiCtrlRead(GuiCtrlRead($Listview), 1) would return the The text of the TreeViewItem..

In the case of a combobox then

GUICtrlRead($Combo1) would return The value selected

GuiCtrlRead(GUICtrlRead($Combo1)) would return 0

Cheers

Share this post


Link to post
Share on other sites
PreludeOfDeath

Something like this I suppose:

#include <GUIConstants.au3>

GUICreate("Form1", 208, 97, 231, 172)
$Combo1 = GUICtrlCreateCombo("Peanut Butter", 18, 16, 173, 125)
GUICtrlSetData(-1,"Turkey","Peanut Butter")
$Combo2 = GUICtrlCreateCombo("", 18, 54, 173, 125)
GUICtrlSetData(-1,"Jelly|Honey","Jelly")
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            $Type=GUICtrlRead($Combo1)
            Switch $Type
                Case "Peanut Butter"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Jelly|Honey","Jelly")
                Case "Turkey"
                    GUICtrlSetData($Combo2,"")
                    GUICtrlSetData($Combo2,"Mayo|Lettuce","Mayo")
            EndSwitch           
    EndSwitch
WEnd
Thank you! That works great!

Exactly what I was looking for...

All I need now is how to loop my GUI...

Share this post


Link to post
Share on other sites
Guest BillBeavis

Is there any reason you are not using the OnEvent stuff? I've switch my GUI's from the method you use to OnEvents, seems to run "smoother" and the GUI is more responsive.

Share this post


Link to post
Share on other sites
PreludeOfDeath

Cause I dont know how to properly use them! <_<

I will look into it on the good-ole' help file....

Thanks!

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  

×