Mickey Mathieson <[EMAIL PROTECTED]> wrote:
--- chetan verma <[EMAIL PROTECTED]>
wrote:
> hi,
> I am trying to create a "drop down tree" control
> similar to "drop down list" (or combobox). I have
> derived my class from CComboBox and have a CTreeCtrl
> object in my derived class. What I am trying to do
> is draw my tree over the dropped down list box.
> Everything works fine except the scroll bar.
> After I make my tree visible I call SetCapture to
> capture all the mouse inputs (Two reasons to do so:
> 1] I need to know if user clicked outside tree so
> that i can make the tree invisible 2] The dropped
> down list of the combo box does the same thing so,
> to make sure that messages are sent to tree instead
> of the list control.)
> But After calling this the scroll bar in the tree
> doesn't works. I can scroll using the mouse wheel
> but scroll bar doesn't responds.
> If you know how to handle this please help me.
> If you have any doubts please let me know.
>
>
> Following are the functions called to show/hide the
> tree
>
>
//=============================================================================
> void uiTreeComboBox::show_drop_down(CRect*
> dropped_rect)
> {
> InterceptParentWndProc(); //function to subclass
> parent window to capture the messages sent by
> combobox to its parent
> display_tree(dropped_rect); //dropped rect is the
> rect of the dropped down list
> dropped_state = utTRUE;
> m_treectrl.Invalidate();
> Invalidate();
> ::SetCapture(m_treectrl.GetSafeHwnd());
> }
>
>
>
//=============================================================================
> void uiTreeComboBox::hide_drop_down()
> {
> dropped_state = utFALSE;
> ::ReleaseCapture();
> m_treectrl.ShowWindow(SW_HIDE);
> UnInterceptWndProc();
> Invalidate();
> }
>
The mouse capture should only be set when the mouse
leaves the drop down (treecntl).
Check out the messages WM_MOUSELEAVE and WM_MOUSENTER.
When the WM_MOUSELEAVE is sent turn on the mouse
capture. When WM_MOUSEENTER is sent turn off the mouse
capture.
Mickey M.
Construction Partner Inc.
http://www.constructionpartner.com
Thanks Mickey for your help. I tried doing this but it did not help. After I
capture mouse i don't get the mouse leave message. And also after releasing i
am not getting any mouse move messages until i click on the tree window.
Is there any way to get the handle of the scroll bar in the tree window. What I
am thinking is to post the message to scroll bar whenever i get mouse move or
mouse click messages.
Thanks and regards
chetan
---------------------------------
Check out the hottest 2008 models today at Yahoo! Autos.
[Non-text portions of this message have been removed]