Managed C++ MAKE_DELEGATE and LostFocus event in VS2005

G

Guest

I am using Managed C++ with a CFormView and a MaskedTextBox and have used
MAKE_DELEGATE to sink the LostFocus event of this control.

I have other events I've sinked off this control and they all work fine,
however, the LostFocus does not fire.

I found Scribble online and they do the same thing I did, however, when I
used this code in Visual Studio 2005 the LostFocus event didn't get fired
either.

My example code looks like this:

m_cValue->LostFocus += MAKE_DELEGATE( System::EventHandler, OnLostFocus );

In DoDataExchange:
DDX_ManagedControl(pDX, IDC_VALUE, m_cValue);

CWinFormsControl<System::Windows::Forms::MaskedTextBox> m_cValue;

If I run into problems, I code it in C# and then convert it to C++. It
works fine in C#, however, my managed C++ does not. Is there something I've
implemented incorrectly?

Thanks,
Carmon
 
M

Marcus Heege

From your explanations I can not see anything that you have made wrong.

My assumption is that the LostFocus event is not fired when the control is
hosted in an MFC window. I will do some tests with that now.

Marcus
 
G

Guest

Marcus,

Could you either post or email me your test application? I have attempted
this with entirely managed C++ and WinForms but I haven't been able to get
CDialog or CFormView applications to work so I figured it was something I was
doing wrong.

Thanks,
Carmon

Marcus Heege said:
I have done a simple test with an MFC Dialog App, and the LostFocus event is
fired for a MaskedTextBox as well as for a normal TextBox.

There seems to be something else wrong with your code. Maybe my article [1]
is helpful for you.

[1] http://msdn.microsoft.com/msdnmag/issues/06/05/MixAndMatch/default.aspx

Marcus

Marcus Heege said:
From your explanations I can not see anything that you have made wrong.

My assumption is that the LostFocus event is not fired when the control is
hosted in an MFC window. I will do some tests with that now.

Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top