请问我怎么用PostMessage()实现象前移动焦点

wanzhongyi 2002-11-07 02:20:12
我有一个窗体,上面有几个TEdit控件,我想实现按上下方向键时,在这几个TEdit控件上移动焦点
void __fastcall Tfrm::KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key==38)
{
PostMessage(Handle,WM_NEXTDLGCTL,0,0);
}
}
1、现在我只能往后移动焦点,但不能往前移动,请问我怎么才能往前移动呢?谢谢。
2、我在看PostMessage()函数帮助时,其第二个参数是UINT Msg,我怎样知道其取值都是什么呢?
...全文
48 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bcbsoft 2002-12-27
  • 打赏
  • 举报
回复
if(Key==VK_DOWN)
{
PostMessage(this->Handle,WM_NEXTDLGCTL,0,0);
Key=0;
}
if(Key==VK_UP)
{
PostMessage(this->Handle,WM_NEXTDLGCTL,1,0);
Key=0;
}
wanzhongyi 2002-11-08
  • 打赏
  • 举报
回复
谢谢
wanzhongyi 2002-11-08
  • 打赏
  • 举报
回复
谢谢 invalid(空心菜之冬日晨练) ,但我不知道msdn还有C++ builder 的帮助吗?
invalid 2002-11-07
  • 打赏
  • 举报
回复
1.看看msdn,测试一下应该就可以了。
2.UINT Msg取值就是所有的消息,WM_之类的。
The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_NEXTDLGCTL
WPARAM wParam, // control identifier
LPARAM lParam // wParam usage
);
Parameters
wParam
If lParam is TRUE, this parameter identifies the control that receives the focus. If lParam is FALSE, this parameter indicates whether the next or previous control with the WS_TABSTOP style receives the focus. If wParam is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus.
lParam
The low-order word indicates how the system uses wParam. If the low-order word is TRUE, wParam is a handle associated with the control that receives the focus; otherwise, wParam is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus.
wanzhongyi 2002-11-07
  • 打赏
  • 举报
回复
为什么没人理我???????
wanzhongyi 2002-11-07
  • 打赏
  • 举报
回复
请高手指点,谢谢!

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧