Modify

Opened 12 years ago

Closed 12 years ago

#409 closed Bug (No Bug)

Checkbox check goes to Select Case while not programmed to do so

Reported by: Triblade Owned by:
Milestone: Component: AutoIt
Version: 3.2.13.3 Severity: None
Keywords: Cc:

Description

First, this script is a copied script of somebody I tried to help url: http://www.autoitscript.com/forum/index.php?showtopic=74538

Go to the menu, choose A. Then a new GUI is made and the old one deleted.
Then you see 3 checkboxes. When I press the 3rd one ('C') the Case $msg = $A (the Case where the second GUI is made) is run by again.
I can't figure out why. I think this is a bug.
Why? Because when $Start = GUICtrlCreateButton is put before $Checkbox1 = GUICtrlCreateCheckbox it just works fine.
Also if $how = GUICtrlCreateButton is uncommented there is no fault anymore.

#include <GUIConstants.au3>

Dim $Checkbox1, $Checkbox2, $Checkbox3

HotKeySet("{F1}", "How")

$gui = GUICreate("Update Addons - Menu", 300, 300)  

;$how = GUICtrlCreateButton( "How To Use", 0, 10)

$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)

$Menu = GUICtrlCreateMenu ("Menu")
$A = GUICtrlCreateMenuitem ("A",$Menu)

GUISetState (@SW_SHOW)

While 1
	$msg = GUIGetMsg()
	Select
		Case $msg = $GUI_EVENT_CLOSE
			ExitLoop
		Case $Msg = $Start
			$Read = GUICtrlRead($Checkbox1);start
			If $Read = $GUI_CHECKED Then
				RunWait("notepad")
				Sleep(2000)
			EndIf
			$Read = GUICtrlRead($Checkbox2);start
			If $Read = $GUI_CHECKED Then
				RunWait('"' & @ProgramFilesDir & '\Internet Explorer\IEXPLORE.EXE"')
				Sleep(2000)
			EndIf;end
			$Read = GUICtrlRead($Checkbox3)
			If $Read = $GUI_CHECKED Then
				RunWait("notepad")
				Sleep(2000)
			EndIf
		Case $msg = $A
			msgbox(0,"","Second GUI")
			;$title = WinGetTitle( "Update Mods -")
			Guidelete($gui)
			$gui2 = GUICreate("Update Addons - A", 700, 500)
			
			$Checkbox1 = GUICtrlCreateCheckbox("A", 20, 5)
			$Checkbox2 = GUICtrlCreateCheckbox("B", 20, 25)
			$Checkbox3 = GUICtrlCreateCheckbox("C", 20, 45)
			
			$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
			
			GUISetState (@SW_SHOW)
	EndSelect
Wend

Func quit()
	exit    
EndFunc

Func How()
	msgbox(0, "title", "text")
EndFunc

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Jpm

in fact when you delete first gui and recreate a new one the controlid of the new one are the same as the one of the first one so your msg loop will getevent and the corresponding old code will be executed

comment:2 Changed 12 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.