Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Click event on CXTPControlEdit
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Click event on CXTPControlEdit

 Post Reply Post Reply
Author
Message
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post Topic: Click event on CXTPControlEdit
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2005 at 4:35pm

You can override CXTPControlEdit and its

virtual void OnSetFocus(CWnd* pOldWnd);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2005 at 11:49am
Worked perfect. Thanks a lot.
Back to Top
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post 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


 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post 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

 

 

 

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
csturg View Drop Down
Newbie
Newbie


Joined: 13 July 2005
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote csturg Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.