EditCtrl即将被禁用. [英] EditCtrl coming disabled.

查看:54
本文介绍了EditCtrl即将被禁用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用VC 2k8开发基于MFC对话框的应用程序.

我放入了一个编辑控件,并为此创建了一个类(MyEdit)..
我为MyEdit类型的编辑ctrl创建了一个变量.

当我编译并运行时,edit ctrl显示为禁用.

我做错什么了吗?

对不起,下面的帖子

我的输入启用功能的作用是这个

Hi,

i am developing a MFC dialog based application with VC 2k8.

i put in an edit control and created a class (MyEdit)for it..
and i created a variable for the edit ctrl of type MyEdit.

when i compile and run, the edit ctrl is displayed as disabled.

am i doing anything the wrong way?

Sorry for the below post

what my input enable function does is this

LRESULT CSampleAppDlg::OnInputEnable(WPARAM wParam, LPARAM lParam)
{
	// Set active edit box
	m_hWndEdit = (HWND)wParam;
	return 0;
}



我创建了一个新项目,该项目不显示任何内容,但显示UI.
在这种情况下,当我创建一个editcontrol并为其创建一个类并设置一个成员变量时,也会观察到相同的结果.

帮我 !!! :(



i have created a new project that does nothin but display the UI.
in that too when i create a editcontrol and create a class for it and set a member variable the same thing is observed.

Help Me !!! :(

推荐答案

使用普通的CEdit类,效果很好.

这是我的newEdit类


with normal CEdit class it is coming fine.

this is my newEdit class


#include "stdafx.h"
#include "SampleApp.h"
#include "newEdit.h"

this is my newEdit class

// newEdit dialog

IMPLEMENT_DYNAMIC(newEdit, CDialog)

newEdit::newEdit(CWnd* pParent /*=NULL*/)
	: CDialog(newEdit::IDD, pParent)
{

}

newEdit::~newEdit()
{
}

void newEdit::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(newEdit, CDialog)
	ON_WM_SETFOCUS()
END_MESSAGE_MAP()


// newEdit message handlers

void newEdit::OnSetFocus(CWnd* pOldWnd)
{
	CDialog::OnSetFocus(pOldWnd);

	// TODO: Add your message handler code here
	HWND hWndKeybdDlg = ::FindWindow(NULL, _T("keyboard"));
	if( hWndKeybdDlg )
	{
		::SendMessage(hWndKeybdDlg, WM_USER+1, (WPARAM)m_hWnd, 0);
	}
}



在主对话框的OnInitDialog函数中,我将HWND成员变量设置为指向Edit Ctrl的句柄.



in the OnInitDialog function of the main dialog, i set a HWND member variable to point to the Edit Ctrl''s handle.

m_hWndEdit = m_eBox.m_hWnd;



完成一些功能后,



after doin some functionality,

::SetFocus(m_hWndEdit);


被称为.

我已经包括


is called.

i have included

ON_MESSAGE(WM_USER+1, &CSampleAppDlg::OnInputEnable)


做消息映射.

我有一个疑问是,我在地图上输入了上面的代码.我应该为覆盖做其他事情吗?


to do the message mapping.

one doubt i have is, i have jus typed in the above code for the map. should i be doing something else for the override?


首先尝试使用普通的CEdit类,看看是否存在相同的问题.

如果您遇到相同的问题,则意味着该问题并非来自您的类(您可能错误地设置了属性,或者某些代码由于某种原因禁用了控件).

如果您没有相同的问题,则表示问题来自您的MyEdit类.

共享一些代码可以帮助我们解决问题...
Try first with the normal CEdit class to see if you have the same problem.

If you have the same problem, it means the problem doesn''t come from your class (you probably set properties by mistake, or some code is disabling your control for some reason).

If you don''t have the same problem, it means the problem comes from your MyEdit class.

Sharing some code could help us fix the issue...


这篇关于EditCtrl即将被禁用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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