RE: Re: CWindowImpl and dynamically created button

"Jonathan Davies" <jonathangdavies-XZoyATsUNX5Wk0Htik3J/[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <001701ca5332$5cba1690$162e43b0$@com>
Hi,

Do you know there are example projects included in WTL? though how they
relate to mobile apps I don't know. 

I do remember when having struggled with certain WTL issues, I found out
there were examples I could have looked at all the time though!

Jonathan

 

From: [email protected] [mailto:[email protected]] On Behalf Of Root
Null
Sent: 22 October 2009 16:46
To: [email protected]
Subject: Re: [wtl] Re: CWindowImpl and dynamically created button

 

  

Thanks for the replies: I'm using Remote Spy (this application is on Windows
Mobile, actually) and it confirms that clicking on the button does not
generate any messages in ANY windows in the application.

I will build out an app that isolates the behavior I'm seeing on the desktop
platform and post a link to that once I'm done (or if it doesn't have the
same problem!).

--- On Wed, 10/21/09, domehead100 <[email protected]
<mailto:domehead100%40gmail.com> > wrote:

> From: domehead100 <[email protected] <mailto:domehead100%40gmail.com>
>
> Subject: [wtl] Re: CWindowImpl and dynamically created button
> To: [email protected] <mailto:wtl%40yahoogroups.com> 
> Date: Wednesday, October 21, 2009, 9:20 AM
> As Jim, said, a small code sample or
> sample project would be helpful.
> 
> With the freezes, it sounds like something is definitely
> not right :o).
> 
> How do you know the button is not sending messages? 
> Are you using Spy++? If that doesn't work for you, there are
> some fairly easy ways to hook SendMessage calls and log them
> in your debug build, for example, using the Detours library
> from Microsoft.
> 
> --- In [email protected] <mailto:wtl%40yahoogroups.com> ,
> Root Null <imperialgeniusx@...> wrote:
> >
> > Mike,
> > thanks for the response: I am
> creating (4) inside of (2), but setting (3) to be its
> parent. I'm looking for just regular run of the mill button
> behavior: when I click on the button it should switch
> colors/behave like a button/generate WM_COMMAND messages to
> someone (ANYONE will do), but none of those happen at all.
> > 
> > To further complicate things, I've been getting these
> periodic application freezes: the app simply stops
> responding to clicks or scrolls or menu requests. About 1
> out of every 3 times, it recovers after 10 to 20 seconds.
> Other times I have to force kill the debugging session. I'm
> assuming both of these are somehow related and there's
> something foolish I'm doing, but I'm at a bit of a loss. I'm
> largely a Java person or old style Win32, and this WTL thing
> is new for me.
> > 
> > Imp.
> > 
> > --- On Tue, 10/20/09, domehead100
> <domehead100@...> wrote:
> > 
> > > From: domehead100 <domehead100@...>
> > > Subject: [wtl] Re: CWindowImpl and dynamically
> created button
> > > To: [email protected] <mailto:wtl%40yahoogroups.com> 
> > > Date: Tuesday, October 20, 2009, 11:57 AM
> > > Are you creating (4) inside of (2),
> > > even though (4) is a child of (3)?
> > > wnd.Create(_display->m_hWnd, rc, _T("TEST"),
> > > WS_CHILD|WS_VISIBLE,0,ID_TEST_ACTION);
> > > 
> > > (noting _display->m_hWnd)
> > > 
> > > Anyway, the button will send messages to it's
> parent. 
> > > The parent is apparently _display. Are you
> looking for
> > > the messages in _display's message map? If
> you're
> > > looking for them in (2)'s message map, they won't
> be sent to
> > > (2) but rather to (3)(_display) since that it the
> button's
> > > parent.
> > > 
> > > ~Mike
> > > 
> > > 
> > > 
> > > 
> > > --- In [email protected] <mailto:wtl%40yahoogroups.com> ,
> > > "imperialgeniusx" <imperialgeniusx@>
> wrote:
> > > >
> > > > Hi all,
> > > > I'm new to WTL and
> implementing
> > > custom controls and have been having some
> difficulty with
> > > what SHOULD be a pretty straightforward thing:
> adding a
> > > button to a CWindowImpl and then having the
> button respond
> > > to clicks and generate events. For some reason,
> this simply
> > > doesn't happen.
> > > > 
> > > > The basic hierarchy I have is
> > > > 
> > > > CFrameWindowImpl
> > > > CWindowImpl (1)
> > > > CWindowImpl (2)
> > > > CButton (4)
> > > > CButton (3)
> > > > 
> > > > The numbers reflect the order things are
> created:
> > > everything is dynamically created, and (2) and
> (3) are
> > > created at the same time as children of (1), and
> (4) is
> > > created on demand later on as a child of (2).
> > > > 
> > > > When I display (1) and click on (3), I get
> WM_COMMAND
> > > messages. When I click on (2) anywhere other than
> the
> > > drawing area of (4), I get WM_LBUTTONDOWN and
> WM_LBUTTONUP
> > > messages. (4) is correctly drawn: I get WM_PAINT
> messages
> > > and the button appears in the CWindowImpl area
> correctly.
> > > However when I click on (4) I get nothing: no
> > > WM_LBUTTONDOWN, WM_LBUTTONUP or anything of that
> ilk.
> > > > 
> > > > (2) is created using the following code:
> > > > 
> > > > CVerticalLayout * _display = new
> > > CVerticalLayout(m_hWnd, IDC_DETAILS_LAYOUT);
> > > > 
> > > > where CVerticalLayout is based on
> CWindowImpl.
> > > The constructor for CVerticalLayout does this:
> > > > 
> > > > this->Create(parent, NULL,
> L"VerticalLayout",
> > > WS_CHILD|WS_VISIBLE|WS_TABSTOP,0,uID);
> > > > 
> > > > and uses the following declarations/message
> map
> > > > 
> > > >
> DECLARE_WND_SUPERCLASS(_T("VerticalLayout"),
> > > GetWndClassName())
> > > > BEGIN_MSG_MAP(CVerticalLayout)
> > > > 
> MESSAGE_HANDLER(WM_CREATE,
> > > OnCreate)
> > > > 
> MESSAGE_HANDLER(WM_VSCROLL,
> > > OnVScroll)
> > > > 
> MESSAGE_HANDLER(WM_KEYDOWN,
> > > OnKeyDown)
> > > > 
> MESSAGE_HANDLER(WM_DESTROY,
> > > OnDestroy)
> > > > END_MSG_MAP()
> > > > 
> > > > (3) is created using the following code:
> > > > 
> > > > CButton _action;
> > > > _action.Create(this->m_hWnd,NULL,
> szDownload,
> > >
> WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,0,ID_DETAILS_ACTION);
> > > > 
> > > > and (4) is created using this:
> > > > 
> > > > RECT rc;
> > > > rc.top = 0; rc.bottom = 30; rc.left = 0;
> rc.right =
> > > 150;
> > > > CButton wnd;
> > > > wnd.Create(_display->m_hWnd, rc,
> _T("TEST"),
> > > WS_CHILD|WS_VISIBLE,0,ID_TEST_ACTION);
> > > > 
> > > > Is this something that
> anyone else
> > > has seen before, or is there a magic setting
> somewhere I
> > > need to deploy to make this do the right thing? I
> thought
> > > that if (3) works then (4) should just work, but
> this
> > > doesn't seem to be the case. I don't even get the
> default
> > > button action when clicked. I get absolutely
> nothing. I've
> > > looked at this using Spy and it confirms that no
> messages
> > > are being sent to any of the windows in the
> application when
> > > I hover over the button's paint area and click,
> but messages
> > > are sent when I click anywhere else on the
> application.
> > > > 
> > > > Thanks,
> > > > Imp.
> > > >
> > > 
> > > 
> > > 
> > > 
> > > ------------------------------------
> > > 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > mailto:[email protected]
<mailto:wtl-fullfeatured%40yahoogroups.com> 
> > > 
> > > 
> > >
> >
> 
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> mailto:[email protected]
<mailto:wtl-fullfeatured%40yahoogroups.com> 
> 
> 
> 





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



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

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:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.