找回密码
 加入
搜索
查看: 1384|回复: 1

关于Shell.Explorer.2与GUICtrlCreateedit冲突问题的解决办法

[复制链接]
发表于 2009-7-5 15:24:54 | 显示全部楼层 |阅读模式
窗体1有这样一个控件:GUICtrlCreateObj里面的obj是Shell.Explorer.2
又有窗体二有这样一个控件GUICtrlCreateInput或GUICtrlCreateEdit,出现窗体二需要隐含窗体一,问题出来了:
当在窗体一点击了GUICtrlCreateObj这个控件后再隐含窗体一,窗体二里面的GUICtrlCreateInput和GUICtrlCreateEdit退格键不好使了!

解决办法是建立窗体二之前将焦点转移到窗体一其他控件上去,这样做就可避免上述奇怪的问题了
 楼主| 发表于 2009-7-5 15:45:08 | 显示全部楼层
;为了更明白的说明这一点,你可以看看下面的范例,注意注释部分,去掉那一行你试验一下吧!
#include <GUIConstantsEx.au3>
$forms = GUICreate('', 800, 600)
GUISetState(@SW_SHOW, $forms)
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 800, 560)
$button1 = GUICtrlCreateButton('1', 10, 570, 20, 20)
$button2 = GUICtrlCreateButton('2', 40, 570, 20, 20)
GUISetState(@SW_SHOW, $forms)
$oIE.navigate("http://www.google.com")

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case - 3
                        Exit
                Case $button1
                        GUICtrlSetState($button1 , $gui_focus) ;等页面加载完,没有这一行你试试,
                        GUISetState(@SW_HIDE, $forms)
                        $forms2 = GUICreate('', 800, 600)
                        $editbox = GUICtrlCreateEdit('试验一下退格吧', 0, 0, 800, 600)
                        GUISetState(@SW_SHOW, $forms2)

                        While 1
                                $nMsg = GUIGetMsg()
                                Switch $nMsg
                                        Case - 3
                                                GUISetState(@SW_SHOW, $forms)
                                                GUIDelete($forms2)
                                                ExitLoop
                                EndSwitch

                        WEnd
        EndSwitch

WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-28 02:21 , Processed in 0.067441 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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