![]() |
Click event on CXTPControlEdit |
Post Reply ![]() |
Author | |
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
You can override CXTPControlEdit and its virtual void OnSetFocus(CWnd* pOldWnd); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Send in this overriden member message to site: m_pParent->GetSite()->SendMessage(WM_YOURMESSAGE, 0, (LPARAM)this);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
Worked perfect. Thanks a lot.
|
|
![]() |
|
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
In CustomThemes sample I added: void CControlComboBoxEx::OnSetFocus(CWnd* pOldWnd) { void CMainFrame::OnCustomize() .. } and it works. But are you sure you need ControlEdit/ControlCombox that never receive focus?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
csturg ![]() Newbie ![]() Joined: 13 July 2005 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |