Sign in to follow this  
Followers 0
bvr

Button Functions

5 posts in this topic

#1 ·  Posted (edited)

I'm new with GUI's and Autoit. Seems to be alot different than Liberty Basic. I have a main GUI window that is the shell of the program. When I press the "add" button, I want another GUI to come up on top of the main GUI. I got it almost working, but as soon as I press the "add" button, the second GUI comes up, then goes away right away. Here is the code.

;Resume Pal 1.0
;by: Brandon M. Royer
;12/**/2010

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Resume Pal 1.0", 808, 481, 192, 124)
; MENU
$FileMenu = GuiCtrlCreateMenu("File")
$FileItem = GUICtrlCreateMenuItem("Open...", $FileMenu)
$FileItemTwo = GUICtrlCreateMenuItem("New", $FileMenu)
$FileItemThree = GUICtrlCreateMenuItem("Save", $FileMenu)
$FileItemFour = GUICtrlCreateMenuItem("Print", $FileMenu)
$FileItemFive = GUICtrlCreateMenuItem("Close", $FileMenu)
$HelpMenu = GuiCtrlCreateMenu("Help")
$HelpItem = GUICtrlCreateMenuItem("Online Forums", $HelpMenu)
$HelpItemTwo = GuiCtrlCreateMenuItem("About", $HelpMenu)

$Group1 = GUICtrlCreateGroup("General", 8, 8, 793, 169)
$Label1 = GUICtrlCreateLabel("First Name:", 32, 48, 57, 17)
GUICtrlCreateInput("", 96, 48, 121, 21)
$Label2 = GUICtrlCreateLabel("Last Name:", 256, 48, 58, 17)
GUICtrlCreateInput("", 328, 48, 121, 21)
$Label3 = GUICtrlCreateLabel("MI:", 480, 48, 19, 17)
GUICtrlCreateInput("", 512, 48, 33, 21)
$Label4 = GUICtrlCreateLabel("Address:", 40, 96, 45, 17)
GUICtrlCreateInput("", 96, 88, 121, 21)
$Label5 = GUICtrlCreateLabel("City:", 288, 96, 24, 17)
GUICtrlCreateInput("", 328, 88, 121, 21)
$Label6 = GUICtrlCreateLabel("State:", 472, 96, 32, 17)
GUICtrlCreateInput("", 520, 88, 121, 21)
$Label7 = GUICtrlCreateLabel("Phone Number:", 16, 136, 78, 17)
GUICtrlCreateInput("", 96, 128, 121, 21)
$Label8 = GUICtrlCreateLabel("Email:", 288, 136, 32, 17)
GUICtrlCreateInput("", 328, 128, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Background", 8, 192, 793, 273)
$Label9 = GUICtrlCreateLabel("Education:", 96, 232, 55, 17)
$List1 = GUICtrlCreateList("", 16, 256, 249, 149)
$Button1 = GUICtrlCreateButton("Add", 16, 416, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Edit", 104, 416, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Delete", 192, 416, 75, 25, $WS_GROUP)
$Label10 = GUICtrlCreateLabel("Work Experience:", 352, 232, 89, 17)
$List2 = GUICtrlCreateList("", 280, 256, 249, 149)
$Add = GUICtrlCreateButton("Add", 280, 416, 75, 25, $WS_GROUP)
$Edit = GUICtrlCreateButton("Edit", 368, 416, 75, 25, $WS_GROUP)
$Delete = GUICtrlCreateButton("Delete", 456, 416, 75, 25, $WS_GROUP)
$Label11 = GUICtrlCreateLabel("Strengths/Other", 624, 232, 80, 17)
GUICtrlCreateEdit("", 544, 256, 241, 185)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    ;Case $GUI_EVENT_CLOSE
    Case $Button1
        #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Brandon\Desktop\Files2\koda_1.7.2.0\Forms\education.kxf
$Form2 = GUICreate("Education", 552, 412, 286, 144)
$Group1 = GUICtrlCreateGroup("Education", 8, 8, 537, 169)
$Label1 = GUICtrlCreateLabel("School Name:", 32, 48, 71, 17)
GUICtrlCreateInput("", 104, 40, 121, 21)
$Label2 = GUICtrlCreateLabel("Phone Number:", 272, 48, 78, 17)
GUICtrlCreateInput("", 352, 40, 121, 21)
$Label3 = GUICtrlCreateLabel("Address:", 40, 88, 45, 17)
GUICtrlCreateInput("", 96, 80, 129, 21)
$Label4 = GUICtrlCreateLabel("City:", 264, 88, 24, 17)
GUICtrlCreateInput("", 296, 80, 121, 21)
$Label5 = GUICtrlCreateLabel("State:", 48, 136, 32, 17)
GUICtrlCreateInput("", 88, 128, 121, 21)
$Label6 = GUICtrlCreateLabel("Zip Code:", 256, 136, 50, 17)
GUICtrlCreateInput("", 320, 128, 89, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Study", 8, 192, 537, 177)
$Label7 = GUICtrlCreateLabel("Highest Degree Earned:", 24, 224, 118, 17)
GUICtrlCreateInput("", 152, 216, 121, 21)
$Label8 = GUICtrlCreateLabel("Number of Years Attended:", 24, 256, 132, 17)
GUICtrlCreateInput("", 160, 248, 33, 21)
$Label9 = GUICtrlCreateLabel("GPA:", 24, 296, 29, 17)
GUICtrlCreateInput("", 56, 288, 33, 21)
$Label10 = GUICtrlCreateLabel("Dates Attended:", 24, 336, 81, 17)
GUICtrlCreateInput("", 112, 328, 121, 21)
$Label11 = GUICtrlCreateLabel("Area's of Study:", 336, 216, 78, 17)
GUICtrlCreateEdit("", 296, 240, 241, 121)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Save", 24, 376, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Exit", 120, 376, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Exit

EndSwitch
WEnd
Edited by bvr

Share this post


Link to post
Share on other sites



yeah that worked. Now how do I make it so it focus's on the new window. So that you cannot go back to the main window until you either cancel or save on the new GUI window. You know what I mean? You gotta finish with the new window before you can go back to the main.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I just realized its going to get confusing. I have 1 loop for the main GUI, then I have 2 more buttons on the 2nd GUI so I would have to make another loop for that GUI, then there will be a 3rd GUI to figure out...

Edited by bvr

Share this post


Link to post
Share on other sites

yeah that worked. Now how do I make it so it focus's on the new window. So that you cannot go back to the main window until you either cancel or save on the new GUI window. You know what I mean? You gotta finish with the new window before you can go back to the main.

GUISetState ( @SW_DISABLE , $gui_handle_to_disable )

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