如何在TAB键的窗口中的控件之间导航? [英] How to navigate between controls in a Window by TAB key?

查看:203
本文介绍了如何在TAB键的窗口中的控件之间导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过调用 CreateWindow 创建了一个窗口,并在其上放置了2个编辑控件。
编辑控件有 WS_TABSTOP 样式,已启用。我可以改变它的文本,但控件之间的导航TAB键没有工作。

I created a window by calling CreateWindow, and put 2 edit controls on it. The edit controls had WS_TABSTOP style, which was enabled. I could change its text, but navigation between controls by TAB key did not work.

我将此代码放入我的邮件循环中:

I put this code in my message loop:

MSG msg;
while ( GetMessage( &msg, NULL, 0, 0 ) )
{
    if ( !msg.hwnd || !IsDialogMessage( msg.hwnd, &msg ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
}


$ b <没有编辑,并且通过按TAB发生的唯一的事情是第一控制的文本的选择。

Unfortunately, navigating by TAB did not work, edit controls didn't edit, and the only thing happened by pressing TAB was the selection of the text of first control. Can anybody help me?

推荐答案

您传递给IsDialogMessage的窗口句柄是您要浏览的类似对话框的窗口。您正在传递接收邮件的窗口,这可能是编辑控件,而不是顶层窗口。

The window handle you pass to IsDialogMessage is the dialog-like window you want to navigate through. You are passing the window that received the message, which is probably the edit control, not the top-level window.

这篇关于如何在TAB键的窗口中的控件之间导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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