Print Page | Close Window

Click event on CXTPControlEdit

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=2572
Printed Date: 16 June 2024 at 6:53am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Click event on CXTPControlEdit
Posted By: csturg
Subject: Click event on CXTPControlEdit
Date Posted: 13 July 2005 at 1:40pm

I have a created an edit control (CXTPControlEdit) on a command bar. I would like to be notified when the user activates the control by clicking in the edit control text area. How would I capture this event?

Thanks, Craig




Replies:
Posted By: Oleg
Date Posted: 13 July 2005 at 4:35pm

You can override CXTPControlEdit and its

virtual void OnSetFocus(CWnd* pOldWnd);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: csturg
Date Posted: 13 July 2005 at 7:00pm

Thanks. That worked. Just one more question. Although I am able to capture the event in my derived class now, I really need to handle the event in my mainframe or view class. What is the best way to route this event to my mainframe class?

Thanks again.



Posted By: Oleg
Date Posted: 14 July 2005 at 1:52am

Send in this overriden member message to site:

m_pParent->GetSite()->SendMessage(WM_YOURMESSAGE, 0, (LPARAM)this);

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: csturg
Date Posted: 14 July 2005 at 11:49am
Worked perfect. Thanks a lot.


Posted By: csturg
Date Posted: 17 July 2005 at 4:20pm

Although the method you suggested works:

i.e., You can override CXTPControlEdit and its virtual void OnSetFocus(CWnd* pOldWnd);

If I popup a dialog (modal or modeless) from that handled event three strange things happen:

1) The edit control on my popped up dialog has no caret (cursor)

2) The OnSetFocus() event is only called the first time the user clicks in the toolbar edit control.  Subsequent clicks are ignored after the first click that popped up the dialog. Only clicking on the edit control border triggers the event.

3) After this sequence, the caret on the toolbar edit control no longer exists, even if it has the focus.

Any ideas?

Thanks


 



Posted By: Oleg
Date Posted: 18 July 2005 at 5:59am

Hmm, don't know how it looks for end user if you open dialog when he just click edit.

Anyway you must before move focus away from Edit.

call

XTPMouseManager()->SendTrackLost(); it will unselct edit.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: csturg
Date Posted: 18 July 2005 at 10:51am

Thanks, I tried that, but same problem occurs. Even if I just display a message box as follows, OnSetFocus only gets called that first time and the toolbar edit control is unresponsive from that point on:

void TToolBarEditControl::OnSetFocus(CWnd* pOldWnd)

{

XTPMouseManager()->SendTrackLost();

AfxMessageBox("hello");

}

Thanks

 

 

 

 



Posted By: Oleg
Date Posted: 19 July 2005 at 8:16am

In CustomThemes sample I added:

void CControlComboBoxEx::OnSetFocus(CWnd* pOldWnd)

{
 CXTPControlComboBox::OnSetFocus(pOldWnd);
 
 m_pParent->GetSite()->PostMessage(WM_COMMAND, XTP_ID_CUSTOMIZE);
}

void CMainFrame::OnCustomize()
{
 XTPMouseManager()->SendTrackLost();

 ..

}

and it works. But are you sure you need ControlEdit/ControlCombox that never receive focus?

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: csturg
Date Posted: 19 July 2005 at 11:23am

Thanks again for all of you help, but that still only works for the first click. Here is a brief explanation of what I am trying to do:

When the user clicks on the edit control, I am immediately popping up a floating mulitline CEdit control window (or a CEdit control in a modeless dialog) that will cover the toolbar edit control and expand in size as the user types text. So the edit control will need to grow beyond the toolbar window boundaries. The edit control on the toolbar is only there to appear like an edit control to the user and to launch the floating control when they click on it. This is why I want to kill the focus and launch my floating edit control as soon as the user clicks on the toolbar edit control.

Unless you can think of a way to have a multiline edit control on one of your toolbar, no need to respond further on this issuse. I will try doing it using CToolbar or CDialogBar.

Thanks again.

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net