Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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


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 !!! :(
Posted
Updated 29-Jul-11 0:29am
v4

with normal CEdit class it is coming fine.

this is my newEdit class


C++
#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);
	}
}


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

C++
m_hWndEdit = m_eBox.m_hWnd;


after doin some functionality,
C++
::SetFocus(m_hWndEdit);

is called.

i have included

C++
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?
 
Share this answer
 
Comments
Olivier Levrey 29-Jul-11 5:13am    
It is better to use the "Improve question" instead of posting a solution...

I don't know what your OnInputEnable is, but you should try to comment out all the code you added untill it works. Then uncomment some parts to know exactly which lines make your control disabled.
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...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900