Sign in to follow this  
Followers 0
Tasmania

SW_HIDE and SW_SHOW for different windows stops only exit button code

1 post in this topic

#1 ·  Posted (edited)

This is weird... for some reason, when I run this code (it should work on your computer as well, it's not calling anything yet..) and click continue from the main form to the next form, it all displays correctly, however when I go back to the other form, the exit button no longer works. What I find odd about this is everything else works, and from the file menu you are able to exit.

Anyone know why?

; GUI creation
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\uspjefe\desktop\projects\frmnew.kxf
$frmSLA = GUICreate("Syte Line Automation", 218, 285, -1, -1)
$lblAttn = GUICtrlCreateLabel("&Attn:", 8, 8, 32, 17)
$txtAttn = GUICtrlCreateInput("", 88, 8, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$lblEmail = GUICtrlCreateLabel("Emai&l:", 8, 32, 38, 17)
$txtEmail = GUICtrlCreateInput("", 88, 32, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$lblPwo = GUICtrlCreateLabel("&PWO #:", 8, 56, 49, 17)
$txtPwo = GUICtrlCreateInput("", 88, 56, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$lblSca = GUICtrlCreateLabel("&SCA # (No 0):", 8, 80, 76, 17)
$txtSca = GUICtrlCreateInput("", 88, 80, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$lblDesc = GUICtrlCreateLabel("&Description:", 8, 104, 66, 17)
$txtDesc = GUICtrlCreateInput("", 88, 104, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$lblReqDate = GUICtrlCreateLabel("&Req. Date:", 8, 128, 62, 17)
$dteRstdate = GUICtrlCreateDate("2007/10/01 12:23:9", 88, 128, 122, 21, $WS_TABSTOP)
$lblPE = GUICtrlCreateLabel("Project &Enj:", 8, 152, 64, 17)
$txtPE = GUICtrlCreateInput("", 88, 152, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
GUICtrlSetLimit(-1, 2)
$lblPM = GUICtrlCreateLabel("Project &Mngr:", 8, 176, 73, 17)
$txtPM = GUICtrlCreateInput("", 88, 176, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
GUICtrlSetLimit(-1, 2)
$lblCharge = GUICtrlCreateLabel("C&harge:", 8, 200, 47, 17)
$txtCharge = GUICtrlCreateInput("", 88, 200, 121, 21, BitOR($ES_UPPERCASE,$ES_AUTOHSCROLL))
$btnContinue = GUICtrlCreateButton("&Continue", 136, 232, 75, 25, $BS_DEFPUSHBUTTON)
$btnExit = GUICtrlCreateButton("E&xit", 8, 232, 75, 25, 0)
$mnuFile = GUICtrlCreateMenu("&File")
$mnuNew = GUICtrlCreateMenuItem("&New", $mnuFile)
$mnuOpen = GUICtrlCreateMenuItem("&Open", $mnuFile)
$mnuSave = GUICtrlCreateMenuItem("&Save", $mnuFile)
$mnuSep1 = GUICtrlCreateMenuItem("", $mnuFile)
$mnuExit = GUICtrlCreateMenuItem("E&xit", $mnuFile)
$mnuEdit = GUICtrlCreateMenu("&Edit")
$mnuCopy = GUICtrlCreateMenuItem("&Copy", $mnuEdit)
$mnuPaste = GUICtrlCreateMenuItem("&Paste", $mnuEdit)
$mnuSep2 = GUICtrlCreateMenuItem("", $mnuEdit)
$mnuPO = GUICtrlCreateMenuItem("&PO Information", $mnuEdit)
$mnuQty = GUICtrlCreateMenuItem("&Quantity", $mnuEdit)
$mnuNotes = GUICtrlCreateMenuItem("&Extra Notes", $mnuEdit)
$mnuType = GUICtrlCreateMenu("&Type")
$mnuConcept = GUICtrlCreateMenuItem("&Concept", $mnuType, -1 , 1)
GUICtrlSetState(-1, $GUI_CHECKED)
$mnuReconcept = GUICtrlCreateMenuItem("&Reconcept", $mnuType, -1 , 1)
$mnuSample = GUICtrlCreateMenuItem("&Sample", $mnuType, -1 , 1)
$mnuResample = GUICtrlCreateMenuItem("R&esample", $mnuType, -1 , 1)
$mnuAddsam = GUICtrlCreateMenuItem("&Additional Sample", $mnuType, -1 , 1)
$mnuHST = GUICtrlCreateMenuItem("&Heat Seal Tool", $mnuType, -1 , 1)
$mnuBFT = GUICtrlCreateMenuItem("&Blister Form Tool", $mnuType, -1 , 1)
$mnuSep3 = GUICtrlCreateMenuItem("", $mnuType)
$mnuAddMG = GUICtrlCreateMenuItem("Add &Material/Gauge", $mnuType)
$mnuPcode = GUICtrlCreateMenu("&Product Code")
$mnuConcpt = GUICtrlCreateMenuItem("SAM-&CONCPT", $mnuPcode, -1 , 1)
GUICtrlSetState(-1, $GUI_CHECKED)
$mnuSampl = GUICtrlCreateMenuItem("SAM-&SAMPL", $mnuPcode, -1 , 1)
$mnuAddl = GUICtrlCreateMenuItem("SAM-&ADDL", $mnuPcode, -1 , 1)
$mnuFAC = GUICtrlCreateMenuItem("MAH-FA&C", $mnuPcode, -1 , 1)
$mnuFAM = GUICtrlCreateMenuItem("MAH-FA&M", $mnuPcode, -1 , 1)
$mnuVAC = GUICtrlCreateMenuItem("BFT-&VAC", $mnuPcode, -1 , 1)
$mnuPress = GUICtrlCreateMenuItem("BFT-&PRESS", $mnuPcode, -1 , 1)
GUISetState(@SW_SHOW, $frmSLA)
#EndRegion ### END Koda GUI section ###

; ********** Variables that are needed to start **********
Global $displayed = 0
Global $readonly = 0
; ********** End variables that are needed to start **********

While 1
 $nMsg = GUIGetMsg()
 
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   panic()
   
  Case $btnExit
   panic()
   
  Case $mnuExit
   panic()
   
  Case $mnuNew
   new()
   
  Case $mnuSave   
   save()
   
  Case $mnuOpen
   open()
   
  Case $mnuCopy
   Send("^c")
   
  Case $mnuPaste
   Send("^v")
   
  Case $btnContinue
   GUISetState(@SW_HIDE, $frmSLA)
   
   $back = 0
   
   #Region ### START Koda GUI section ### Form=C:\Documents and Settings\USPJEFE\Desktop\Projects\frmConfirm.kxf
   $frmConfirm = GUICreate("Syte Line Automation - Please Confirm", 411, 364, -1, -1)
   $lblHeader = GUICtrlCreateLabel("The following information is going to automatically be filled in. Please confirm this.", 0, 0, 410, 17)
   $lblAttn = GUICtrlCreateLabel("Attn:", 8, 32, 26, 17)
   $txtAttn = GUICtrlCreateInput("", 88, 32, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblEmail = GUICtrlCreateLabel("Email:", 8, 56, 32, 17)
   $txtEmail = GUICtrlCreateInput("", 88, 56, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPwo = GUICtrlCreateLabel("PWO #:", 8, 80, 43, 17)
   $txtPwo = GUICtrlCreateInput("", 88, 80, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblInum = GUICtrlCreateLabel("Full Item #:", 8, 104, 56, 17)
   $txtInum = GUICtrlCreateInput("", 88, 104, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblDesc = GUICtrlCreateLabel("Desc:", 8, 128, 32, 17)
   $edtDesc = GUICtrlCreateEdit("", 88, 128, 121, 41, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL))
   $lblRqstDate = GUICtrlCreateLabel("Request Date:", 8, 176, 73, 17)
   $txtRqstDate = GUICtrlCreateInput("", 88, 176, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblType = GUICtrlCreateLabel("Type:", 8, 200, 31, 17)
   $txtType = GUICtrlCreateInput("", 88, 200, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPcode = GUICtrlCreateLabel("Product Code:", 8, 224, 72, 17)
   $txtPcode = GUICtrlCreateInput("", 88, 224, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPO = GUICtrlCreateLabel("PO #:", 224, 32, 32, 17)
   $txtPO = GUICtrlCreateInput("", 280, 32, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPOamt = GUICtrlCreateLabel("PO Amt:", 224, 56, 43, 17)
   $txtPOamt = GUICtrlCreateInput("", 280, 56, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPOdisc = GUICtrlCreateLabel("PO Disc:", 224, 80, 46, 17)
   $txtPOdisc = GUICtrlCreateInput("", 280, 80, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPE = GUICtrlCreateLabel("Proj. Enj:", 224, 104, 46, 17)
   $txtPE = GUICtrlCreateInput("", 280, 104, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPM = GUICtrlCreateLabel("Proj. Mngr:", 224, 128, 55, 17)
   $txtPM = GUICtrlCreateInput("", 280, 128, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblCharge = GUICtrlCreateLabel("Charge:", 224, 152, 41, 17)
   $txtCharge = GUICtrlCreateInput("", 280, 152, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblQty = GUICtrlCreateLabel("Qty:", 224, 176, 23, 17)
   $txtQty = GUICtrlCreateInput("", 280, 176, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblMat = GUICtrlCreateLabel("Material:", 224, 200, 44, 17)
   $txtMat = GUICtrlCreateInput("", 280, 200, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblGauge = GUICtrlCreateLabel("Gauge:", 224, 224, 39, 17)
   $txtGauge = GUICtrlCreateInput("", 280, 224, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblExNotes = GUICtrlCreateLabel("Extra Notes:", 8, 248, 62, 17)
   $edtExNotes = GUICtrlCreateEdit("", 8, 272, 305, 81, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
   $btnRun = GUICtrlCreateButton("&Run", 328, 264, 75, 25, $BS_DEFPUSHBUTTON)
   $btnBack = GUICtrlCreateButton("&Back", 328, 296, 75, 25, 0)
   $btnExit = GUICtrlCreateButton("E&xit", 328, 328, 75, 25, 0)
   GUISetState(@SW_SHOW, $frmConfirm)
   #EndRegion ### END Koda GUI section ###

   While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
     Case $GUI_EVENT_CLOSE
      panic()
      
     Case $btnExit
      panic()
      
     Case $btnBack
      $back = 1
      GUISetState(@SW_HIDE, $frmConfirm)
      ExitLoop
    EndSwitch
   WEnd
   
   ; remove the window
   ;GUISetState(@SW_HIDE)
   
   ;BlockInput(1)
   
   ;WinWaitNotActive("Syte Line Automation", "", 10)
   
   ; call the execution code
   ;#include <test-include.au3>
   
   ;new()
   
   ;BlockInput(0)
   
   ; show the gui
   GUISetState(@SW_SHOW, $frmSLA)
 EndSwitch
WEnd

Edit: Nevermind, I got it. Apparently the multiple buttons with the same name didn't work quite like I thought. Thanks.

Edited by Tasmania

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