第二个窗口点关闭关不了
{:face (355):} 在 Example 函數裡的第一行加上 Opt("GUIOnEventMode", 0)
最後一行加上 Opt("GUIOnEventMode", 1)
另外,迴圈裡的判斷要改一下,要不就禁用 "请选择nuke项目目录" 窗口 ;---------------------------------------------------------------------------
#include <GUIConstantsEx.au3>
Dim $ll , $Form1 ,$Button__1 ,$Button__2 ,$Input__1 ,$Button__3, $nuke1
Func Example()
$bmp = FileFindFirstFile( $ll & "\*.bmp")
;MsgBox(0, $bmp, $bmp )
$nk = FileFindFirstFile( $ll & "\*.nk")
$nuke1 = "C:\Program Files\Nuke6.0v3\Nuke6.0.exe " & $ll & FileFindNextFile($nk)
Opt('MustDeclareVars', 1)
Local $Button_1,$msg
GUICreate("NUKE工程",1080,330,20,20,0x00380000)
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("", 10, 10, 130,130,0x81,0x00000310)
GUISetState() ; will display andialog box with 2 button
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
EndFunc ;==>Example
;-----------------------------------------------------------------
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("请选择nuke项目目录", 312, 115, 379, 143)
GUISetOnEvent($GUI_EVENT_CLOSE, "tuichu");退出按钮
$Button__1 = GUICtrlCreateButton("确定(&O)", 33, 75, 75, 25, 0)
GUICtrlSetOnEvent($Button__1, "queding");确定按钮
$Button__2 = GUICtrlCreateButton("取消(&C)", 130, 75, 75, 25, 0)
GUICtrlSetOnEvent($Button__2,"quxiao");取消按钮
$Input__1 = GUICtrlCreateInput("选择目录", 8, 40, 217, 21)
$Button__3 = GUICtrlCreateButton("浏览(&R)", 232, 40, 75, 25, 0)
GUICtrlSetOnEvent($Button__3, "liulang");浏览按钮
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func liulang();浏览按钮,
$ll=FileSelectFolder("浏览","")
If FileExists($ll) Then
GUICtrlSetData($Input__1,$ll)
EndIf
EndFunc
Func queding();确定按钮
Example()
exit
EndFunc
Func quxiao();取消按钮
exit
EndFunc
Func tuichu();退出按钮
Exit
EndFunc 大家帮帮忙拉{:face (238):} 已经完全看不懂了,上面是消息模式。下面的代码又定义为事件模式。
按道理应该是抄了两段不同的代码。但变量又上下相互关联。 下次贴多行代码最好先整理,并用代码标签Opt('GUIOnEventMode', 1)
Dim $ll, $Form1, $Button__1, $Button__2, $Input__1, $Button__3, $nuke1
$Form1 = GUICreate('请选择nuke项目目录', 312, 115, 379, 143)
GUISetOnEvent(-3, 'tuichu');退出按钮
$Button__1 = GUICtrlCreateButton('确定(&O)', 33, 75, 75, 25, 0)
GUICtrlSetOnEvent($Button__1, 'Example');确定按钮
$Button__2 = GUICtrlCreateButton('取消(&C)', 130, 75, 75, 25, 0)
GUICtrlSetOnEvent($Button__2, 'tuichu');取消按钮
$Input__1 = GUICtrlCreateInput('选择目录', 8, 40, 217, 21)
$Button__3 = GUICtrlCreateButton('浏览(&R)', 232, 40, 75, 25, 0)
GUICtrlSetOnEvent($Button__3, 'liulang');浏览按钮
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func liulang();浏览按钮,
$ll = FileSelectFolder('浏览', '')
If FileExists($ll) Then GUICtrlSetData($Input__1, $ll)
EndFunc ;==>liulang
Func tuichu();退出按钮
Exit
EndFunc ;==>tuichu
Func Example()
GUISetState(@SW_HIDE, $Form1)
Opt('GUIOnEventMode', 0)
Opt('GUICoordMode', 2)
$bmp = FileFindFirstFile($ll & '\*.bmp')
$nk = FileFindFirstFile($ll & '\*.nk')
$nuke1 = 'C:\Program Files\Nuke6.0v3\Nuke6.0.exe ' & $ll & FileFindNextFile($nk)
$Form2 = GUICreate('NUKE工程', 1080, 330, 20, 20, 0x00380000)
Local $Button_1 = GUICtrlCreateButton('', 10, 10, 130, 130, 0x81, 0x00000310)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
GUIDelete()
Opt('GUIOnEventMode', 1)
GUISwitch($Form1)
GUISetState(@SW_SHOW)
ExitLoop
Case $Button_1
MsgBox(0, 0, '点击了超大按钮 _ _||')
EndSwitch
WEnd
EndFunc ;==>Example {:face (239):}知道了
页:
[1]