Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Doubleclick in CExtToolBoxWnd Collapse All
Subject Author Date
Suhai Gyorgy Jun 1, 2007 - 5:47 AM

Dear Support,

I’m trying to implement the kind of feature which I’ve seen in some applications using Toolbox: When the user doubleclicks a Toolbox item, it gets "locked", and that item stays selected even after creating an object of the type represented by the Toolbox item. I have some questions regarding this.

1. In my CExtToolBoxWnd-derived class I handle the WM_LBUTTONDBLCLK message. It works fine mostly, but if my Toolbox item is too long and ContentExpand window is needed to see the full title of the item, WM_LBUTTONDBLCLK stops working, I guess because ContentExpand window receives the click instead of the Toolbox window. How could I resolve this?

2. While reading through your code regarding doubleclick in Toolbox, I’ve seen that the original CExtToolBoxWnd class handles the WM_LBUTTONDBLCLK message as well, it seems for editing the items. I’ve tried to make a sample demonstrating this doubleclick problem, but I couldn’t get the item to go into editor mode, not even the ones without ContentExpand window. I’ve applied the __TBWI_EDITABLE style to all items and OnToolBoxWndStartItemEditor returns a valid HWND in CExtToolBoxWnd::OnLButtonDblClk, but still the inplace editor does not appear. Why?

Best regards,
Chris

Technical Support Jun 1, 2007 - 9:22 AM

Please find the following code in the CExtToolBoxWnd::OnToolBoxWndItemHoverChange() method:

      m_wndContentExpand.Activate(
            rcItem,
            this,
            __ECWAF_DEFAULT|__ECWAF_DRAW_SOURCE
            );
and replace it with:
      m_wndContentExpand.Activate(
            rcItem,
            this,
            __ECWAF_DEFAULT|__ECWAF_DRAW_SOURCE|__ECWAF_TRANSPARENT_WND
            );
Now the popup window has the WS_EX_TRANSPARENT extended window style and passes the mouse clicks through it.

To fix the editing issues, use the following two changes:

1) The CExtToolBoxWnd::OnLButtonDown() method should have the following code at the beginning:
      if( m_hWndEditor != NULL )
      {
            CPoint ptScreen = point;
            ClientToScreen( &ptScreen );
            if( ::WindowFromPoint( ptScreen ) == m_hWndEditor )
                  return;
      }
2) The CExtToolBoxWnd::OnLButtonUp() and CExtToolBoxWnd::OnMouseMove() methods should have the following code at the beginning:
      if( GetEditorHWND() != NULL )
            return;


Suhai Gyorgy Jun 4, 2007 - 3:36 AM

I’m sorry, I should have written only after trying to see if the fix worked. But unfortunately it doesn’t. In my app I only need the proper responding to doubleclick, so that’s what I tried out. I still don’t receive the message and now the contentexpand window doesn’t paint correctly:
http://people.inf.elte.hu/puffy/Prof-UIS/ProfUIS_ToolBox.jpg

Technical Support Jun 4, 2007 - 5:02 AM

We have just sent you the updated source code for CExtToolBoxWnd. Firstl, please check your application again. If the problem persists, then invoke the Configure Toolbox command from the context menu over the toolbox in the FormEditor sample and try to find a set of toolbox options when the same problem with the expand tip windows appears. If this experiment reproduces the problem, then please send us a screenshot with the toolbox configuration dialog demonstrating checked/unchecked check boxes in it.

Suhai Gyorgy Jun 4, 2007 - 7:56 AM

First of all: I’m still using v2.64, I don’t know if this could cause the problem. Second: I’m only testing the doubleclick problem, not the one with the inplace editor.

The source code you sent me by e-mail had the __ECWAF_TRANSPARENT_WND flag uncommented in the code of your first post. When the flag is in effect, the strange painting appears. When the flag is not in effect (as in the code you sent me by e-mail), the painting is fine. In either case, I do not receive WM_LBUTTONDBLCLK message. I’ve done my testing with your original FormEditor sample (present in v2.64), adding a very little code in MainFrm.h:

	CExtToolBoxWnd::TOOLBOX_ITEM_DATA * m_pTBCI_helper_menu_focus;
//vv added from here
protected:
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()
//ˆˆadded till here
private:
	bool	m_bDropBefore:1,
and in MainFrm.cpp:
	{ _T("Custom Control"), __IMG_TOOLBOX_CUSTOMCTRL , false , false, NULL, 0L },

};

//vv added from here
BEGIN_MESSAGE_MAP(CFormEditorToolBoxWnd, CExtToolBoxWnd)
	ON_WM_LBUTTONDBLCLK()
END_MESSAGE_MAP()

void CFormEditorToolBoxWnd::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	CExtToolBoxWnd::OnLButtonDblClk(nFlags, point);
	CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI = ItemHitTest( point );
	if ( pTBCI != NULL )
		TRACE1("OnLButtonDblClk %s\n", OnToolBoxWndQueryItemText(pTBCI));
	else
		TRACE0("OnLButtonDblClk Empty\n");
}
//ˆˆ added till here

void CFormEditorToolBoxWnd::_InitToolBoxImpl()
{
Trace message is always seen when doubleclicking an item without ContentExpandWnd, but never seen when doubleclicking an item with long text (where ContentExpandWnd is used).

I tried setting different styles with the toolbox configuration dialog, but the behaviour was the same no matter what toolbox options I chose.

Thank you very much for your help!

Technical Support Jun 4, 2007 - 12:25 PM

The __ECWAF_TRANSPARENT_WND flag makes the content expand window having the WS_EX_TRANSPARENT extended window style which makes window "transparent" for mouse click events. The __ECWAF_TRANSPARENT_WND flag is needed and it can not affect to the Z-Order of the window. We need additional information: which layout should toolbox window use and could you provide us with exact styles of it The problem is not related to the difference in CExtContentExpandWnd and CExtToolBoxWnd classes in 2.64 and 2.70 because they are mostly exactly the same. Would you send us your copy of the FormEditor sample where the problem occurs.

Suhai Gyorgy Jun 5, 2007 - 1:50 AM

Sample sent. I’m using the default layout of the ToolBox, meaning that I’ve cleared the registry from the saved settings of the sample and reproduced the error right after starting the application. I’d like to clarify: as I stated in my last post and in my e-mail, the version of ExtToolBoxWnd that you’ve sent me yesterday, has the __ECWAF_TRANSPARENT_WND flag commented, even though now you are saying it’s needed!!!

Technical Support Jun 5, 2007 - 7:03 AM

We received your e-mail and replied with a working application ZIPped in attachment.

Suhai Gyorgy Jun 6, 2007 - 6:29 AM

Reply sent with ZIPped attachment, I hope it went through alright.

Technical Support Jun 6, 2007 - 9:46 AM

We have just replied by email.

Suhai Gyorgy Jun 4, 2007 - 2:15 AM

Just to clarify and be sure: the very beginning of CExtToolBoxWnd::OnLButtonDown originally looked like this:

void CExtToolBoxWnd::OnLButtonDown(UINT nFlags, CPoint point) 
{
//	CExtScrollWnd::OnLButtonDown(nFlags, point);
	nFlags;
 
	if( GetFocus() != this )
		_SetToolBoxFocus();
 
	if( m_hWndEditor != NULL )
	{
		OnToolBoxWndCancelItemEditor( m_hWndEditor );
		m_hWndEditor = NULL;
	}
	...
}
and now it should look like this:
void CExtToolBoxWnd::OnLButtonDown(UINT nFlags, CPoint point) 
{
//	CExtScrollWnd::OnLButtonDown(nFlags, point);
	nFlags;
 
	if( GetFocus() != this )
		_SetToolBoxFocus();
 
	if( m_hWndEditor != NULL )
	{
		CPoint ptScreen = point;
		ClientToScreen( &ptScreen );
		if( ::WindowFromPoint( ptScreen ) == m_hWndEditor )
			return;
	}
	...
}
Or maybe like this?:
void CExtToolBoxWnd::OnLButtonDown(UINT nFlags, CPoint point) 
{
//	CExtScrollWnd::OnLButtonDown(nFlags, point);
	nFlags;
 
	if( GetFocus() != this )
		_SetToolBoxFocus();
 
	if( m_hWndEditor != NULL )
	{
		CPoint ptScreen = point;
		ClientToScreen( &ptScreen );
		if( ::WindowFromPoint( ptScreen ) == m_hWndEditor )
			return;
		OnToolBoxWndCancelItemEditor( m_hWndEditor );
		m_hWndEditor = NULL;
	}
	...
}

Technical Support Jun 4, 2007 - 4:52 AM

It should begin like as follows

void CExtToolBoxWnd::OnLButtonDown(UINT nFlags, CPoint point) 
{
//    CExtScrollWnd::OnLButtonDown(nFlags, point);
      nFlags;

      if( m_hWndEditor != NULL )
      {
            CPoint ptScreen = point;
            ClientToScreen( &ptScreen );
            if( ::WindowFromPoint( ptScreen ) == m_hWndEditor )
                  return;
      }

      if( GetFocus() != this )
            _SetToolBoxFocus();

      if( m_hWndEditor != NULL )
      {
            OnToolBoxWndCancelItemEditor( m_hWndEditor );
            m_hWndEditor = NULL;
      }

      m_ptStartLeftBtnTrack.x = m_ptStartLeftBtnTrack.y = -1;

CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI =
            ItemHitTest( point );
      if( pTBCI != NULL )
      {