Что нового

Проблема с декларированием форм и Case

lexaSF

Новичок
Сообщения
182
Репутация
3
Вот код, постоянно в Case вылазиет ошибка что форма была не декларирована.как это исправить.попробывал все переменные в начале декларировать - на 2 окне вылазиют ошибки для 3 окна.помогите.
Код:
$Form1_1 = GUICreate("AvtoStart Accounts", 253, 156, 694, 553)
GUISetIcon("C:\Users\Lexa\Desktop\im.ico")
$ListBox1 = GUICtrlCreateList("", 24, 16, 113, 97)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$Button5 = GUICtrlCreateButton("&Add", 152, 15, 75, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Button1 = GUICtrlCreateButton("&Edit", 152, 51, 75, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Button2 = GUICtrlCreateButton("&Delete", 152, 89, 75, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Button3 = GUICtrlCreateButton("&START!", 85, 125, 75, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Group1 = GUICtrlCreateGroup("", 10, 0, 233, 121)
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label11 = GUICtrlCreateLabel("Create ToSTeP", 183, 140, 70, 18)
GUICtrlSetFont(-1, 7, 800, 0, "Palatino Linotype")
$Label1 = GUICtrlCreateLabel("Zhyk.ru", 32, 141, 42, 20)
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
$Icon1 = GUICtrlCreateIcon("", 0, 5, 128, 24, 24)
GUICtrlSetImage($Icon1, @ScriptFullPath, 201)
GUISetState(@SW_SHOW)
$tray = TraySetIcon("")
GUICtrlSetImage($tray, @ScriptFullPath, 201)
#EndRegion ### END Koda GUI section ###

While 1
	Global $nMsg,$Form2,$Group_2_2,$Radio_2_1,$Radio_2_2,$Label_2_1,$Button_2_1,$Button_2_2,$Form3,$Label_3_1,$Label_3_2,$Label_3_3,$Label_3_4,$Label_3_5,$Label_3_7,$Input_3_1,$Input_3_2,$Input_3_3,$Input_3_4,$Button_3_1,$Button_3_3,$Combo_3_1,$Combo_3_2,$Group_3_1
	If WinExists('Create Account (SID)','') = 0 Then ControlEnable('AvtoStart Accounts','',$Button5)
$nMsg = GUIGetMsg(1)
Select
	Case $nMsg[0] = $Button5
$Form2 = GUICreate("Choosen  Dialog", 230, 117, 272, 186)
$Group_2_2 = GUICtrlCreateGroup("", 18, 16, 193, 65)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Radio_2_1 = GUICtrlCreateRadio("Input on SID", 26, 32, 169, 17)
$Radio_2_2 = GUICtrlCreateRadio("Input on Login", 26, 56, 169, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label_2_1 = GUICtrlCreateLabel("Choose your type of start", 24, 0, 155, 22)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Button_2_1 = GUICtrlCreateButton("Cancel", 123, 88, 89, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
$Button_2_2 = GUICtrlCreateButton("OK", 16, 88, 89, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
GUISetIcon("C:\Users\Lexa\Desktop\im.ico")
GUISetState(@SW_SHOW)
WinMove('Choosen  Dialog','',720,575)
Case $nMsg[0] = $GUI_EVENT_CLOSE
	If $nMsg[1] = $Form1_1 Then
		Exit
	ElseIf $nMsg[1] = $Form2 Then
		GUISwitch($Form2)
		GUIDelete()
	ElseIf $nMsg[1] = $Form3 Then
		GUISwitch($Form3)
		GUIDelete()
	EndIf
EndSelect
Opt('WinTitleMatchMode',3)
$Exist = WinExists('Choosen  Dialog','Choose your type of start')
If $Exist = 1 Then
	Switch $nMsg[0]
	Case $Button_2_2
		If GUICtrlRead($Radio_2_1) = $GUI_UNCHECKED And GUICtrlRead($Radio_2_2) = $GUI_UNCHECKED Then
			MsgBox(0,'ERROR','Choose your start type!')
		ElseIf GUICtrlRead($Radio_2_1) = $GUI_CHECKED Then
				ControlDisable('AvtoStart Accounts','',$Button5)
			$Form3 = GUICreate("Create Account (SID)", 201, 351, 792, 403)
			GUISetIcon("C:\Users\Lexa\Desktop\im.ico")
$Label_3_1 = GUICtrlCreateLabel("SID:", 16, 112, 35, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Input_3_1 = GUICtrlCreateInput("", 16, 40, 169, 21)
$Label_3_2 = GUICtrlCreateLabel("Name:", 16, 16, 50, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Input_3_2 = GUICtrlCreateInput("", 16, 136, 169, 21)
$Label_3_3 = GUICtrlCreateLabel("ID:", 16, 64, 23, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Input_3_3 = GUICtrlCreateInput("", 16, 88, 169, 21)
$Label_3_4 = GUICtrlCreateLabel("Server:", 16, 160, 56, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Input_3_4 = GUICtrlCreateInput("", 16, 184, 169, 21)
$Button_3_1 = GUICtrlCreateButton("Save", 16, 312, 73, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Button_3_3 = GUICtrlCreateButton("Cancel", 112, 312, 73, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Combo_3_2 = GUICtrlCreateCombo("None", 16, 232, 169, 25)
GUICtrlSetData(-1, "1-1|1-2|1-3|1-4|1-5|1-6|1-7|1-8|2-1|2-2|2-3|2-4|2-5|2-6|2-7|2-8|3-1|3-2|3-3|3-4|3-5|3-6|3-7|3-8|4-1|4-2|4-3|4-5")
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
$Label_3_7 = GUICtrlCreateLabel("Map:", 16, 208, 36, 22)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Group_3_1 = GUICtrlCreateGroup("", 8, 0, 185, 345)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label_3_5 = GUICtrlCreateLabel("Setting File:", 16, 256, 74, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
$Combo_3_1 = GUICtrlCreateCombo("None", 16, 280, 169, 25)
GUICtrlSetFont(-1, 8, 800, 0, "Palatino Linotype")
GUISetState(@SW_SHOW)
WinMove('Create Account (SID)','',985,455)
EndIf
Case IsDeclared($Button_3_1) = 1
	If StringLen(GUICtrlRead($Input_3_1)) > 32 Or StringIsSpace(GUICtrlRead($Input_3_1)) = 1 Or StringLen(GUICtrlRead($Input_3_1)) < 32 Then
		MsgBox(0,'ERROR!','Error! Enter a correct SID')
		$Sid_3 = 1
	Else
		$Sid_3 = 0
	EndIf
	If StringLen(GUICtrlRead($Input_3_2)) > 8 Or StringIsDigit(GUICtrlRead($Input_3_2)) = 1 Or StringIsSpace(GUICtrlRead($Input_3_2)) = 1 Then
		MsgBox(0,'ERROR!','Error! Enter a correct ID!')
		$ID_3 = 1
	Else
		$ID_3 = 0
	EndIf
	If StringLen(GUICtrlRead($Input_3_2)) > 5 Or StringIsAlNum(GUICtrlRead($Input_3_3)) = 0  Then
		MsgBox(0,'ERROR!','Error! Enter a correct server!')
		$Serv_3 = 1
	Else
		$Serve_3 = 0
	EndIf
		If GUICtrlRead($Radio_2_2) = $GUI_CHECKED Then
			MsgBox(0,'','1')
			MsgBox(0,'','1')
		EndIf
			GUISwitch($Form2)
	        GUIDelete()
	Case $Button_2_1
			GUISwitch($Form2)
	        GUIDelete()
		EndSwitch
	EndIf
WEnd
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
Добавь в начало:
Код:
#include <GUIConstantsEx.au3>
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
OffTopic:
P.S
У тебя проблема не только с необъявленной переменной :muttley:
 

Yashied

Модератор
Команда форума
Глобальный модератор
Сообщения
5,379
Репутация
2,724
Я воде бы уже давал отет по этому коду.

;)
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
Yashied [?]
Я воде бы уже давал отет по этому коду
Мне кажется тут уже ничего не поможет, lexaSF отказывается учиться (или не доверяет тут никому :whistle:smile:.
 
Верх