本帖最后由 jycel 于 2009-12-28 12:34 编辑
解决方法:二三楼
我们通常都使用GUICtrlSetState (控件,$GUI_FOCUS)来切换焦点
在富文本中却没效果!那位知道其它方法吗?
测试代码如下:#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiRichEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("输入/选择焦点切换", 294, 237, 335, 410)
$hRichEdit1=_GUICtrlRichEdit_Create($Form1,"", 8, 16, 273, 145,BitOR($ES_MULTILINE, $WS_VSCROLL,$ES_READONLY, $ES_AUTOVSCROLL))
$Input1 = GUICtrlCreateInput("", 8, 168, 273, 21)
$Button1 = GUICtrlCreateButton("富文本", 8, 200, 81, 25)
$Button2 = GUICtrlCreateButton("Input框", 96, 200, 89, 25)
$Button3 = GUICtrlCreateButton("退出", 192, 200, 89, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete();一定要加上否则退出后进程都还在
Exit
Case $Button1
GUICtrlSetState ($hRichEdit1,$GUI_FOCUS)
Case $Button2
GUICtrlSetState ($Input1,$GUI_FOCUS)
Case $Button3
GUIDelete();一定要加上否则退出后进程都还在
Exit
EndSwitch
WEnd
|