Sign in to follow this  
Followers 0
DeathnLife

GUI Dismay

4 posts in this topic

#1 ·  Posted (edited)

Right, I made a crappy experimental GUI for a script I'm working on.

But, I think I messed up somwhere in the Switch Case piece of this code.

I have two buttons; 'Save' and 'Exit'. For now Save does nothing, and Exit should close the window/exit the whole script, but both buttons do not have any response. :P

Does anyone know what my fatal error was?

Pleas help!

#include <GuiConstants.au3>

GuiCreate("Settings", 150, 340,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_1 = GuiCtrlCreateLabel("Amount of skills", 10, 10, 140, 20)
$guiskillamount = GuiCtrlCreateInput("8", 120, 10, 20, 20)
$Label_3 = GuiCtrlCreateLabel("Imbue", 10, 35, 90, 20)
$guiimbue = GuiCtrlCreateInput("x", 120, 35, 20, 20)
$Label_5 = GuiCtrlCreateLabel("Skill 1", 10, 60, 90, 20)
$guiskill1 = GuiCtrlCreateInput("1", 120, 60, 20, 20)
$Label_7 = GuiCtrlCreateLabel("Skill 2", 10, 85, 90, 20)
$guiskill2 = GuiCtrlCreateInput("2", 120, 85, 20, 20)
$Label_9 = GuiCtrlCreateLabel("Skill 3", 10, 110, 90, 20)
$guiskill3 = GuiCtrlCreateInput("3", 120, 110, 20, 20)
$Label_11 = GuiCtrlCreateLabel("Skill 4", 10, 135, 90, 20)
$guiskill4 = GuiCtrlCreateInput("4", 120, 135, 20, 20)
$Label_13 = GuiCtrlCreateLabel("Skill 5", 10, 160, 90, 20)
$guiskill5 = GuiCtrlCreateInput("5", 120, 160, 20, 20)
$Label_15 = GuiCtrlCreateLabel("Skill 6", 10, 185, 90, 20)
$guiskill6 = GuiCtrlCreateInput("6", 120, 185, 20, 20)
$Label_17 = GuiCtrlCreateLabel("Skill 7", 10, 210, 90, 20)
$guiskill7 = GuiCtrlCreateInput("7", 120, 210, 20, 20)
$Label_19 = GuiCtrlCreateLabel("Skill 8", 10, 235, 90, 20)
$guiskill8 = GuiCtrlCreateInput("8", 120, 235, 20, 20)
$Label_21 = GuiCtrlCreateLabel("HP Potions", 10, 260, 90, 20)
$guihpslot = GuiCtrlCreateInput("9", 120, 260, 20, 20)
$Label_23 = GuiCtrlCreateLabel("MP Potions", 10, 285, 90, 20)
$guimpslot = GuiCtrlCreateInput("0", 120, 285, 20, 20)
$save = GUICtrlCreateButton("Save", 10, 310, 60, 20, 0)
$exit = GUICtrlCreateButton("Exit", 80, 310, 60, 20, 0)


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $save
    Case $exit
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
Edited by DeathnLife

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>

GuiCreate("Settings", 150, 340,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_1 = GuiCtrlCreateLabel("Amount of skills", 10, 10, 140, 20)
$guiskillamount = GuiCtrlCreateInput("8", 120, 10, 20, 20)
$Label_3 = GuiCtrlCreateLabel("Imbue", 10, 35, 90, 20)
$guiimbue = GuiCtrlCreateInput("x", 120, 35, 20, 20)
$Label_5 = GuiCtrlCreateLabel("Skill 1", 10, 60, 90, 20)
$guiskill1 = GuiCtrlCreateInput("1", 120, 60, 20, 20)
$Label_7 = GuiCtrlCreateLabel("Skill 2", 10, 85, 90, 20)
$guiskill2 = GuiCtrlCreateInput("2", 120, 85, 20, 20)
$Label_9 = GuiCtrlCreateLabel("Skill 3", 10, 110, 90, 20)
$guiskill3 = GuiCtrlCreateInput("3", 120, 110, 20, 20)
$Label_11 = GuiCtrlCreateLabel("Skill 4", 10, 135, 90, 20)
$guiskill4 = GuiCtrlCreateInput("4", 120, 135, 20, 20)
$Label_13 = GuiCtrlCreateLabel("Skill 5", 10, 160, 90, 20)
$guiskill5 = GuiCtrlCreateInput("5", 120, 160, 20, 20)
$Label_15 = GuiCtrlCreateLabel("Skill 6", 10, 185, 90, 20)
$guiskill6 = GuiCtrlCreateInput("6", 120, 185, 20, 20)
$Label_17 = GuiCtrlCreateLabel("Skill 7", 10, 210, 90, 20)
$guiskill7 = GuiCtrlCreateInput("7", 120, 210, 20, 20)
$Label_19 = GuiCtrlCreateLabel("Skill 8", 10, 235, 90, 20)
$guiskill8 = GuiCtrlCreateInput("8", 120, 235, 20, 20)
$Label_21 = GuiCtrlCreateLabel("HP Potions", 10, 260, 90, 20)
$guihpslot = GuiCtrlCreateInput("9", 120, 260, 20, 20)
$Label_23 = GuiCtrlCreateLabel("MP Potions", 10, 285, 90, 20)
$guimpslot = GuiCtrlCreateInput("0", 120, 285, 20, 20)
$save = GUICtrlCreateButton("Save", 10, 310, 60, 20, 0)
$exit = GUICtrlCreateButton("Exit", 80, 310, 60, 20, 0)


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $save
    Case $msg = $exit
        Exit
    Case Else
    ;;;
    EndSelect
WEnd



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Oh, right.

Idiot me :P

Thanks a lot.

Share this post


Link to post
Share on other sites

You know, it might be easier if you just make the little "X" on the top right of the window close the script. To do that you add:

GUISetOnEvent($GUI_EVENT_CLOSE, "LEAVE")

Func LEAVE()
  Exit
EndFunc

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

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