Что нового

Возвращение в предыдущей элемент GUI

lastangel

Новичок
Сообщения
39
Репутация
0
Вот пример кода:
Код:
#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 227, 172, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 64, 64, 97, 33)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			GUICtrlDelete($Button1)
			$Date = GUICtrlCreateMonthCal('',0, 0, 227, 172)
	EndSwitch
WEnd

Вопрос в том, как вернуться обратно к кнопке?
 

Zaramot

I ♥ AutoIt
Сообщения
1,160
Репутация
660
Попробуй так:
Код:
#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 227, 172, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 64, 64, 97, 33)
$Date = GUICtrlCreateMonthCal('',0, 0, 227, 172)
ControlHide($Form1, '', $Date)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ControlHide($Form1, '', $Button1)
			ControlShow($Form1, '', $Date)
		Case $Date
			ControlHide($Form1, '', $Date)
			ControlShow($Form1, '', $Button1)
    EndSwitch
WEnd
 

madmasles

Модератор
Глобальный модератор
Сообщения
7,790
Репутация
2,322
Zaramot [?]
А так не проще?
Код:
#include <GUIConstantsEx.au3>

$hGui = GUICreate('Form1', 227, 172)
$nButton = GUICtrlCreateButton('Button1', 64, 64, 97, 33)
$nDate = GUICtrlCreateMonthCal('', 0, 0, 227, 172)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState()

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $nButton
			GUICtrlSetState($nButton, $GUI_HIDE)
			GUICtrlSetState($nDate, $GUI_SHOW)
		Case $nDate
			GUICtrlSetState($nDate, $GUI_HIDE)
			GUICtrlSetState($nButton, $GUI_SHOW)
	EndSwitch
WEnd
 
Верх