Jump to content

interesting problem still a beginner here


Recommended Posts

ok, my attempt at getting this gui to work properly is failing and i would like some insight on it. the way it's supposed to work is save brings the second gui screen up once the button is pressed on the second gui screen x function is completed iniwrite when i get a better understanding of that, then the second window closes. the issue im having is well i cant close either gui even by the x in the top corner. anyhelp? ive looked through the help section and wasnt able to find the issue

ok figured out why im unable to exit the script the guievent is doing it need to find the right way for a button to work

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("lvcfo main menu", 305, 199, 192, 114)
$Input2 = GUICtrlCreateInput("0.000", 0, 20, 121, 21)
$Input1 = GUICtrlCreateInput("0.000", 0, 41, 121, 21)
$Input3 = GUICtrlCreateInput("0.000", 0, 84, 121, 21)
$Input4 = GUICtrlCreateInput("0.000", 0, 63, 121, 21)
$Input5 = GUICtrlCreateInput("0.000", 0, 105, 121, 21)
$Input6 = GUICtrlCreateInput(".000", 0, 146, 121, 21)
$Input7 = GUICtrlCreateInput("0.000", 0, 125, 121, 21)
$Save = GUICtrlCreateButton("Save",0,168, 49, 25)
GUICtrlSetOnEvent($Save, "Save")
$List1 = GUICtrlCreateList("Car select", 168, 24, 129, 136)
$Label1 = GUICtrlCreateLabel("12", 122, 24, 18, 17)
$Label2 = GUICtrlCreateLabel("13", 122, 48, 22, 17)
$Label3 = GUICtrlCreateLabel("14", 122, 71, 19, 17)
$Label4 = GUICtrlCreateLabel("15", 122, 90, 19, 17)
$Label5 = GUICtrlCreateLabel("16", 122, 109, 19, 17)
$Label6 = GUICtrlCreateLabel("callnumber", 122, 132, 26, 17)
$Label7 = GUICtrlCreateLabel("stop", 122, 151, 40, 17)
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1

$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd



Func Save()
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form2 = GUICreate("save menu", 155, 57, 192, 114)
$carname = GUICtrlCreateInput("carname", 0, 0, 113, 21)
$Button1 = GUICtrlCreateButton("Button1", 40, 24, 73, 25)
GUICtrlSetOnEvent($button1, "whatever")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

EndFunc

Func whatever()
  ;Note: at this point @GUI_CTRLID would equal $okbutton
  MsgBox(0, "GUI Event", "You pressed OK!")
EndFunc
Edited by darklonerlv
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("lvcfo main menu", 305, 199, 192, 114)
$Input2 = GUICtrlCreateInput("0.000", 0, 20, 121, 21)
$Input1 = GUICtrlCreateInput("0.000", 0, 41, 121, 21)
$Input3 = GUICtrlCreateInput("0.000", 0, 84, 121, 21)
$Input4 = GUICtrlCreateInput("0.000", 0, 63, 121, 21)
$Input5 = GUICtrlCreateInput("0.000", 0, 105, 121, 21)
$Input6 = GUICtrlCreateInput(".000", 0, 146, 121, 21)
$Input7 = GUICtrlCreateInput("0.000", 0, 125, 121, 21)
$Save = GUICtrlCreateButton("Save",0,168, 49, 25)
GUICtrlSetOnEvent($Save, "Save")
$List1 = GUICtrlCreateList("Car select", 168, 24, 129, 136)
$Label1 = GUICtrlCreateLabel("12", 122, 24, 18, 17)
$Label2 = GUICtrlCreateLabel("13", 122, 48, 22, 17)
$Label3 = GUICtrlCreateLabel("14", 122, 71, 19, 17)
$Label4 = GUICtrlCreateLabel("15", 122, 90, 19, 17)
$Label5 = GUICtrlCreateLabel("16", 122, 109, 19, 17)
$Label6 = GUICtrlCreateLabel("callnumber", 122, 132, 26, 17)
$Label7 = GUICtrlCreateLabel("stop", 122, 151, 40, 17)
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit"); Added by The Laughing Man

While 1

$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func Save()
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form2 = GUICreate("save menu", 155, 57, 192, 114)
$carname = GUICtrlCreateInput("carname", 0, 0, 113, 21)
$Button1 = GUICtrlCreateButton("Button1", 40, 24, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetOnEvent($button1, "whatever")
GUISetOnEvent($GUI_EVENT_CLOSE, "_closeWindow"); Added by The Laughing Man
EndFunc


Func whatever()
  ;Note: at this point @GUI_CTRLID would equal $okbutton
  MsgBox(0, "GUI Event", "You pressed OK!")
  GUIDelete("save menu"); Added by The Laughing Man
EndFunc

Func _exit(); Added by The Laughing Man
    Exit; Added by The Laughing Man
EndFunc; Added by The Laughing Man

Func _closeWindow(); Added by The Laughing Man
    GUIDelete("save menu"); Added by The Laughing Man
EndFunc; Added by The Laughing Man

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...