izm_ka | 16 Nov 05:53 2009
Picon

Cursor/caret is not shown in an in-place CEdit-derived control

I'm converting an MFC application into WTL 8.1 and stuck with issues. The in-place control (see below) is
working only once. If it looses focus and gets the focus back, cursor/caret is no longer visible; however,
content can be changed by typing. Here is declaration of the in-place Edit control:
class CMyInPlaceEdit:  public CWindowImpl<CMyInPlaceEdit, CEdit>
{
public:
  CMyInPlaceEdit() : CWindowImpl<CMyInPlaceEdit, CEdit>() {}

  BOOL SubclassWindow(HWND hWnd)
  {
    return CWindowImpl<CMyInPlaceEdit, CEdit>::SubclassWindow(hWnd);
  }
BEGIN_MSG_MAP_EX(CMyInPlaceEdit)
  MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
  <<<cut>>>
};

I create the in-place Edit:
m_edit = new CMyInPlaceEdit();
m_edit->Create(m_parent->m_hWnd, urect, NULL, WS_CHILD | ES_AUTOHSCROLL, 0, MenuOrID, 0);

LRESULT CMyInPlaceEdit::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	///CEdit::OnLButtonDown(nFlags, point);
	::DefWindowProc(m_hWnd, uMsg, wParam, lParam);

	bHandled = FALSE;
	return 0;
(Continue reading)

Jim Barry | 16 Nov 14:50 2009

Re: Cursor/caret is not shown in an in-place CEdit-derived control

"izm_ka" wrote:
> LRESULT CMyInPlaceEdit::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM 
> lParam, BOOL& bHandled)
> {
> ///CEdit::OnLButtonDown(nFlags, point);
> ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
>
> bHandled = FALSE;
> return 0;
> }

Don't call the Win32 API function DefWindowProc directly. If you set 
bHandled to FALSE, the message will automatically be passed on to the 
original window procedure. Otherwise, you can leave bHandled as TRUE and 
explcitly call the original window procedure using the 
CWindowImpl::DefWindowProc member function (actually a member of 
CWindowImplBaseT). By the way, there is a rather handy parameterless 
overload of DefWindowProc that calls the original window procedure with the 
current message parameters.

- Jim 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
(Continue reading)

o_magen1 | 17 Nov 01:51 2009
Picon

Best way to debug CTooltipCtrl not showing the tip

Hello All

This is a weird scenario which I cannot understand and I'm looking for a way to debug this and figure it out.

The app is an IE plugin, which is consisted of a BHO and a toolbar. I have a class that inherits from CStatic and
extends its functionality as so:

class CMyStatic : public CWindowImpl< CMyStatic , CStatic >
{
   ...
   CToolTipCtrl m_tip;
};

I create the tooltip as so:

        if ( !m_tip.IsWindow() )
        {
            // create a tool tip
            DWORD dwStyle = WS_POPUP | TTS_NOANIMATE | TTS_NOFADE | TTS_NOPREFIX;
            m_tip.Create( m_hWnd, NULL, NULL, dwStyle );
            if ( m_tip.IsWindow() )
            {
                m_tip.Activate( TRUE );
                m_tip.AddTool( m_hWnd, lpszString );
            }
        }

and in response to the mouse events i relay the event:

//MESSAGE_RANGE_HANDLER( WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage )
(Continue reading)

izm_ka | 17 Nov 03:06 2009
Picon

Re: Cursor/caret is not shown in an in-place CEdit-derived control

Yes, that was it! After I added CWindowImpl::DefWindowProc the cursor is working! Thank you very much!
Jim, may I buy you beer?

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    wtl-digest@... 
    wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Jim Barry | 17 Nov 13:28 2009

Re: Re: Cursor/caret is not shown in an in-place CEdit-derived control

"izm_ka" wrote:
> Yes, that was it! After I added CWindowImpl::DefWindowProc the cursor 
> is working! Thank you very much! Jim, may I buy you beer?

Virtual beer? :)

- Jim 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    wtl-digest@... 
    wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
(Continue reading)

izm_ka | 18 Nov 04:53 2009
Picon

PreTranslateMessage is not called in CMessageFilter and CEdit derived class

Maybe this question has been answered somewhere on forums, but I could not find. Basically, I want to filter
chars in the in-place edit box to allow entering only digits (for integer). I thought that
PreTranslateMessage can help, but the method is never called. My in-place control is derived as:

class CMyInPlaceEdit
	: public CWindowImpl<CMyInPlaceEdit, CEdit>
	, public CMessageFilter
	, public CUpdateUI<CMyInPlaceEdit>
{
public:
    DECLARE_WND_SUPERCLASS(_T("inplaceEdit"), CEdit::GetWndClassName())

    virtual BOOL PreTranslateMessage(MSG* pMsg);
...

Please help...

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)
(Continue reading)

Igor Tandetnik | 18 Nov 06:22 2009

Re: PreTranslateMessage is not called in CMessageFilter and CEdit derived class

izm_ka wrote:
> Maybe this question has been answered somewhere on forums, but I could not find. Basically, I want to
filter chars in the
> in-place edit box to allow entering only digits (for integer). I thought that PreTranslateMessage can
help, but the method is
> never called.

Did you actually register your message filter? Something like

CMessageLoop* pLoop = _Module.GetMessageLoop();
 pLoop->AddMessageFilter(this);

--

-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be
sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
(Continue reading)

izm_ka | 18 Nov 08:09 2009
Picon

Re: PreTranslateMessage is not called in CMessageFilter and CEdit derived class

Nope - I do not really know where to register the message loop. My inplace edit box is shown in an ATL Property
Page which can be invoked from any app, e.g. .NET. I can try to implement MESSAGE_HANDLER(WM_INITDIALOG,
OnInitDialog) in the property page and register the handler there, would that work?

Thank you!

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    wtl-digest@... 
    wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

(Continue reading)

Konstantin Mironovich | 18 Nov 12:38 2009

Re: PreTranslateMessage is not called in CMessageFilter and CEdit derived class

ES_NUMBER style does not work?

-km
  ----- Original Message ----- 
  From: izm_ka
  To: wtl@...
  Sent: Wednesday, November 18, 2009 6:53 AM
  Subject: [wtl] PreTranslateMessage is not called in CMessageFilter and 
CEdit derived class

  Maybe this question has been answered somewhere on forums, but I could not 
find. Basically, I want to filter chars in the in-place edit box to allow 
entering only digits (for integer). I thought that PreTranslateMessage can 
help, but the method is never called. My in-place control is derived as:

  class CMyInPlaceEdit
  : public CWindowImpl<CMyInPlaceEdit, CEdit>
  , public CMessageFilter
  , public CUpdateUI<CMyInPlaceEdit>
  {
  public:
  DECLARE_WND_SUPERCLASS(_T("inplaceEdit"), CEdit::GetWndClassName())

  virtual BOOL PreTranslateMessage(MSG* pMsg);
  ...

  Please help...

[Non-text portions of this message have been removed]

(Continue reading)

Igor Tandetnik | 18 Nov 13:34 2009

Re: PreTranslateMessage is not called in CMessageFilter and CEdit derived class

izm_ka wrote:
> Nope - I do not really know where to register the message loop.

Constructor seems like a good place.

> My inplace edit box is shown in an ATL Property Page which can be
> invoked from any app, e.g. .NET.

I don't know what an "ATL Property Page" is. CMessageFilter is only useful in a WTL application, where the
message pump is implemented with the help of CMessageLoop.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be
sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)
(Continue reading)


Gmane