请教各位:CreateWindow创建的控件为什么不能接收Tab键? (50分)

  • 主题发起人 主题发起人 GipsyCN
  • 开始时间 开始时间
G

GipsyCN

Unregistered / Unconfirmed
GUEST, unregistred user!
uses<br>&nbsp; CommCtrl, ComCtrls...<br><br>FormCreate事件中:<br>&nbsp; &nbsp; InitCommonControl(ICC_INTERNET_CLASSES);<br>&nbsp; &nbsp; CreateWindow('Button', nil, WS_TABSTOP or WS_CHILD or WS_VISIBLE, 56, 32, 130, 23, Handle, 0, hInstance, nil);<br>这个问题其实和下面这个问题异曲同工:<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=463628<br>我看过Controls.pas,只是也不知道怎么解决。<br>感谢各位关注!<br>
 
Did you set the TabOrder!
 
Yes. I have. But it doesnt work!
 
你还是用VCL的TBUTTON类来动态的加吧,还是自家人最亲;)
 
老兄所言极是。<br>不过,我需要一个IP地址输入框,我不喜欢用第三方控件,所以要这样做:<br>&nbsp; &nbsp; InitCommonControl(ICC_INTERNET_CLASSES);<br>&nbsp; &nbsp; hIPEdit := CreateWindow(WC_IPADDRESS, nil, WS_TABSTOP or WS_CHILD or WS_VISIBLE, 56, 32, 130, 23, Handle, 0, hInstance, nil);<br>&nbsp; &nbsp; Windows.SetFocus(hIPEdit);<br>
 
试试这个:<br>&nbsp; TIpEdit = class(TEdit)<br>&nbsp; &nbsp; procedure CreateParams(var Params: TCreateParams); override;<br>&nbsp; end;<br>procedure TIpEdit.CreateParams(var Params: TCreateParams);<br>begin<br>&nbsp; inherited CreateParams(Params);<br>&nbsp; InitCommonControl(ICC_INTERNET_CLASSES);<br>&nbsp; CreateSubClass(Params, WC_IPADDRESS);<br>end;<br>
 
多人接受答案了。
 
后退
顶部