By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,490 Members | 3,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,490 IT Pros & Developers. It's quick & easy.

Managed C++ MAKE_DELEGATE and LostFocus event in VS2005

P: n/a
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::MaskedTex tBox> 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
Apr 13 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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
"Carmon" <Ca****@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
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::MaskedTex tBox> 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


Apr 13 '06 #2

P: n/a
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/is...h/default.aspx

Marcus

"Marcus Heege" <NO****@heege.net> wrote in message
news:On*************@TK2MSFTNGP04.phx.gbl...
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
"Carmon" <Ca****@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
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::MaskedTex tBox> 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


Apr 13 '06 #3

P: n/a
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" wrote:
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/is...h/default.aspx

Marcus

"Marcus Heege" <NO****@heege.net> wrote in message
news:On*************@TK2MSFTNGP04.phx.gbl...
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
"Carmon" <Ca****@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
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::MaskedTex tBox> 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



Apr 13 '06 #4

P: n/a
Carmon,
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


You can download it here: http://www.marcusheege.de/mfctestapp.zip

Marcus Heege
www.heege.net
Apr 13 '06 #5

P: n/a
Thank you, that helped me get my code working for that aspect.

Thanks,
Carmon

"Marcus Heege" wrote:
Carmon,
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


You can download it here: http://www.marcusheege.de/mfctestapp.zip

Marcus Heege
www.heege.net

Apr 17 '06 #6

P: n/a
"Carmon" <Ca****@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
Thank you, that helped me get my code working for that aspect.

Thanks,
Carmon

"Marcus Heege" wrote:
Carmon,
> 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


You can download it here: http://www.marcusheege.de/mfctestapp.zip

Marcus Heege
www.heege.net


You're welcome.
Apr 17 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.