找回密码
 加入
搜索
查看: 5740|回复: 6

[GUI管理] 第二个窗口点关闭关不了

[复制链接]
发表于 2010-10-20 15:32:04 | 显示全部楼层 |阅读模式
悬赏500金钱已解决

最佳答案

查看完整内容

在 Example 函數裡的 第一行加上 Opt("GUIOnEventMode", 0) 最後一行加上 Opt("GUIOnEventMode", 1) 另外,迴圈裡的判斷要改一下,要不就禁用 "请选择nuke项目目录" 窗口
发表于 2010-10-20 15:32:05 | 显示全部楼层
在 Example 函數裡的
第一行加上 Opt("GUIOnEventMode", 0)
最後一行加上 Opt("GUIOnEventMode", 1)
另外,迴圈裡的判斷要改一下,要不就禁用 "请选择nuke项目目录" 窗口
 楼主| 发表于 2010-10-20 15:33:01 | 显示全部楼层
;---------------------------------------------------------------------------
#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 an  dialog 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
 楼主| 发表于 2010-10-20 15:33:59 | 显示全部楼层
大家帮帮忙拉
发表于 2010-10-20 15:39:02 | 显示全部楼层
已经完全看不懂了,上面是消息模式。下面的代码又定义为事件模式。
按道理应该是抄了两段不同的代码。但变量又上下相互关联。
发表于 2010-10-20 15:56:08 | 显示全部楼层
下次贴多行代码最好先整理,并用代码标签
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
 楼主| 发表于 2010-10-20 16:01:57 | 显示全部楼层
知道了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-10 21:46 , Processed in 0.084182 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表