仅在按下Tab键时更改文本框的焦点 [英] change focus of textbox only on tab press

查看:111
本文介绍了仅在按下Tab键时更改文本框的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有两个选项卡页面的表单,当我按下在tabpage1上具有焦点文本框的选项卡时,它应该将焦点移到tabpage2上的文本框.
thx ..

I have one form with two tab pages I want like this when i press tab which has focus textbox on tabpage1 it should move focus to textbox on the tabpage2..

thx..

推荐答案

按键事件.
on key press event..

if(e.KeyCode == 9)
{
     tabcontainer1.ActiveTabIndex=2;
     txtbox2.focus();
}



希望它能起作用.



hope this works..


看看 IsDialogMessage 函数,该函数将允许您使用TAB按钮浏览

Take a look at IsDialogMessage function, this is the function that will permit you to brows using TAB button

while(GetMessage(&msg,0,0,0))
while(GetMessage(&msg,0,0,0))
{
   if (!IsDialogMessage(ghwnd, //for main window
&msg) && !IsDialogMessage(hViewWindow,//for one view window
 &msg) && !TranslateAccelerator( msg.hwnd //for all window i think
,haccel ,&msg))
   {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
   }
}




我匆忙构建此东西,但不是Windows程序员可能会发现一些***让我知道..但是此程序运行良好:)




I build this thing in rush and not a windows programmer might found some *** let me know.. But this program works fine :)


1.只是在tabpage1的txtbox1后面添加另一个文本框
2.如果textbox1选项卡索引为1,则设置文本框的选项卡索引号.将textbox选项卡索引设置为2.
3.on文本框的Enter事件将其转移到选项卡page2上的textbox2
1.just add another textbox behind txtbox1 on tabpage1
2.set tab index number of textbox if textbox1 tab index is 1 set textbox tab index to 2.
3.on Enter event of textbox transfer it to textbox2 which is on the tabpage2


这篇关于仅在按下Tab键时更改文本框的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆