Catching messages of dynamically created CStatic members

Hi fellows. I have a CWnd-derived class that has two CStatic members,
that are created dynamically.

My question is simple: What must I do in order to receive messages of
such members?

This CWnd-derived class is for creating a custom control. This control
needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
and the other as the down arrow. I already placed them, now I need to
receive the notification (the click notification).


// in the header

CStatic m_lblArrowUp;
CStatic m_lblArrowDown;

// in the Create method

m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
this, IDC_ARROWUP);
m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
rectDown, this, IDC_ARROWDOWN);
m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));


Any clue will be really appreciated.

Regards,
FG.

0
7/7/2006 4:47:03 PM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
920 Views

Similar Articles

[PageSpeed] 2

> My question is simple: What must I do in order to receive messages of
> such members?
>
> This CWnd-derived class is for creating a custom control. This control
> needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
> and the other as the down arrow. I already placed them, now I need to
> receive the notification (the click notification).
>
>
> // in the header
>
> CStatic m_lblArrowUp;
> CStatic m_lblArrowDown;
>
> // in the Create method
>
> m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
> this, IDC_ARROWUP);
> m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
> rectDown, this, IDC_ARROWDOWN);
> m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
> m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));

Since you know the IDs of these controls at compile time, you can use
message maps as you normally would if the control was created at design
time. There is no difference from that aspect regardless of how control
was created(design time or dynamically).

---
Ajay

0
ajaykalra (6842)
7/7/2006 4:53:53 PM
Ajay Kalra wrote:
> > My question is simple: What must I do in order to receive messages of
> > such members?
> >
> > This CWnd-derived class is for creating a custom control. This control
> > needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
> > and the other as the down arrow. I already placed them, now I need to
> > receive the notification (the click notification).
> >
> >
> > // in the header
> >
> > CStatic m_lblArrowUp;
> > CStatic m_lblArrowDown;
> >
> > // in the Create method
> >
> > m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
> > this, IDC_ARROWUP);
> > m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
> > rectDown, this, IDC_ARROWDOWN);
> > m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> > MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
> > m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> > MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
>
> Since you know the IDs of these controls at compile time, you can use
> message maps as you normally would if the control was created at design
> time. There is no difference from that aspect regardless of how control
> was created(design time or dynamically).
>
> ---
> Ajay

Hi,

first, thanks for your answer. However, I already tried such approach,
and it didn't work:

BEGIN_MESSAGE_MAP(CTest, CWnd)
    ...
    ON_STN_CLICKED(IDC_ARROWUP, OnUp)
    ON_STN_CLICKED(IDC_ARROWDOWN, OnDown)
    ....
END_MESSAGE_MAP()

I tried with ON_COMMAND, yet it didn't worked.

I was thinking on something. When you create a CStatic with the dialog
editor, you must click on the "Notify" checkbox in order to receive
messages. Since I created them dynamically, perhaps I'm missing to add
the notify style. Have any clue?

Regards,
FG.

0
7/7/2006 5:15:30 PM
fernando.a.gomez.f@gmail.com wrote:
> Ajay Kalra wrote:
> > > My question is simple: What must I do in order to receive messages of
> > > such members?
> > >
> > > This CWnd-derived class is for creating a custom control. This control
> > > needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
> > > and the other as the down arrow. I already placed them, now I need to
> > > receive the notification (the click notification).
> > >
> > >
> > > // in the header
> > >
> > > CStatic m_lblArrowUp;
> > > CStatic m_lblArrowDown;
> > >
> > > // in the Create method
> > >
> > > m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
> > > this, IDC_ARROWUP);
> > > m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
> > > rectDown, this, IDC_ARROWDOWN);
> > > m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> > > MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
> > > m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> > > MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
> >
> > Since you know the IDs of these controls at compile time, you can use
> > message maps as you normally would if the control was created at design
> > time. There is no difference from that aspect regardless of how control
> > was created(design time or dynamically).
> >
> > ---
> > Ajay
>
> Hi,
>
> first, thanks for your answer. However, I already tried such approach,
> and it didn't work:
>
> BEGIN_MESSAGE_MAP(CTest, CWnd)
>     ...
>     ON_STN_CLICKED(IDC_ARROWUP, OnUp)
>     ON_STN_CLICKED(IDC_ARROWDOWN, OnDown)
>     ....
> END_MESSAGE_MAP()
>
> I tried with ON_COMMAND, yet it didn't worked.
>
> I was thinking on something. When you create a CStatic with the dialog
> editor, you must click on the "Notify" checkbox in order to receive
> messages. Since I created them dynamically, perhaps I'm missing to add
> the notify style. Have any clue?
>
> Regards,
> FG.

Hi,

I already solved the problem. Indeed, the main problem was in the
Create method. I changed them into the following:

m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
SS_NOTIFY, rectUp, this, IDC_ARROWUP);
m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
SS_NOTIFY, rectDown, this, IDC_ARROWDOWN);

adding the SS_NOTIFY style, and everything worked fine.

Thanks for your help.

Regards,
FG.

0
7/7/2006 5:23:48 PM
> I was thinking on something. When you create a CStatic with the dialog
> editor, you must click on the "Notify" checkbox in order to receive
> messages. Since I created them dynamically, perhaps I'm missing to add
> the notify style. Have any clue?

You need to have the control with SS_NOTIFY style. 

---
Ajay

0
ajaykalra (6842)
7/7/2006 5:24:50 PM
If it has two members, why bother to create them dynamically?

Note that you have not specifed SS_NOTIFY, so these static controls (they are not pure
CWnd-derived as you suggest) will not generate any notifications at all.

You have not shown any message map entries; you would need to create message map entries.
Because you are deriving from CStatic, the messages you can get are limited.  Another
solution would be to simply put a scrollbar control in as the child of your control.
					joe

On 7 Jul 2006 09:47:03 -0700, "fernando.a.gomez.f@gmail.com"
<fernando.a.gomez.f@gmail.com> wrote:

>Hi fellows. I have a CWnd-derived class that has two CStatic members,
>that are created dynamically.
>
>My question is simple: What must I do in order to receive messages of
>such members?
>
>This CWnd-derived class is for creating a custom control. This control
>needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
>and the other as the down arrow. I already placed them, now I need to
>receive the notification (the click notification).
>
>
>// in the header
>
>CStatic m_lblArrowUp;
>CStatic m_lblArrowDown;
>
>// in the Create method
>
>m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
>this, IDC_ARROWUP);
>m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
>rectDown, this, IDC_ARROWDOWN);
>m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
>m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
>
>
>Any clue will be really appreciated.
>
>Regards,
>FG.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/7/2006 7:49:02 PM
Hi Joseph,

thanks for your interest.

First, I need them to be created dynamically because they represent the
up and down arrow of a custom scrollbar within a custom control.

Second, yes, I didn't specify the SS_NOTIFY, that was the mistake
indeed.

Next, either I explained myself wrong or you didn't understand. I never
said I want some controls derived from CStatic, I said I'm creating a
custom control, derived from CWnd as any other custom control, that has
two members of type CStatic. I didn't show message map entries because
there was no need to.

Thanks again for your comments.

Regards,
FG.

Joseph M. Newcomer wrote:
> If it has two members, why bother to create them dynamically?
>
> Note that you have not specifed SS_NOTIFY, so these static controls (they are not pure
> CWnd-derived as you suggest) will not generate any notifications at all.
>
> You have not shown any message map entries; you would need to create message map entries.
> Because you are deriving from CStatic, the messages you can get are limited.  Another
> solution would be to simply put a scrollbar control in as the child of your control.
> 					joe
>
> On 7 Jul 2006 09:47:03 -0700, "fernando.a.gomez.f@gmail.com"
> <fernando.a.gomez.f@gmail.com> wrote:
>
> >Hi fellows. I have a CWnd-derived class that has two CStatic members,
> >that are created dynamically.
> >
> >My question is simple: What must I do in order to receive messages of
> >such members?
> >
> >This CWnd-derived class is for creating a custom control. This control
> >needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
> >and the other as the down arrow. I already placed them, now I need to
> >receive the notification (the click notification).
> >
> >
> >// in the header
> >
> >CStatic m_lblArrowUp;
> >CStatic m_lblArrowDown;
> >
> >// in the Create method
> >
> >m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
> >this, IDC_ARROWUP);
> >m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
> >rectDown, this, IDC_ARROWDOWN);
> >m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
> >m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
> >
> >
> >Any clue will be really appreciated.
> >
> >Regards,
> >FG.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

0
7/10/2006 4:29:58 PM
BUt you could put a scrollbar inside a custom control trivially; just create it as the
child control of your custom control!  

The confusion arose because you talk about two custom controls, and two controls derived
from CStatic, and the association seemed to be 1:1.

But if you need a scrollbar, just create it as a child control of your custom control, and
in your custom control put the message map entries to handle it.  Unless you need some
weird size control, this should work fine.  If you need some weird size control that can't
be created from CScrollBar, then you can make the controls child controls of hte custom
control, and siblings of the other controls inside the static control.  If you only need
an up/down control, just use an up/down control, which you can resize to the size you
need.  Note that the dialog editor has some weird behavior in terms of sizing, so when
I've done this, I have to resize the control at runtime.  
					joe

On 10 Jul 2006 09:29:58 -0700, "fernando.a.gomez.f@gmail.com"
<fernando.a.gomez.f@gmail.com> wrote:

>
>Hi Joseph,
>
>thanks for your interest.
>
>First, I need them to be created dynamically because they represent the
>up and down arrow of a custom scrollbar within a custom control.
>
>Second, yes, I didn't specify the SS_NOTIFY, that was the mistake
>indeed.
>
>Next, either I explained myself wrong or you didn't understand. I never
>said I want some controls derived from CStatic, I said I'm creating a
>custom control, derived from CWnd as any other custom control, that has
>two members of type CStatic. I didn't show message map entries because
>there was no need to.
>
>Thanks again for your comments.
>
>Regards,
>FG.
>
>Joseph M. Newcomer wrote:
>> If it has two members, why bother to create them dynamically?
>>
>> Note that you have not specifed SS_NOTIFY, so these static controls (they are not pure
>> CWnd-derived as you suggest) will not generate any notifications at all.
>>
>> You have not shown any message map entries; you would need to create message map entries.
>> Because you are deriving from CStatic, the messages you can get are limited.  Another
>> solution would be to simply put a scrollbar control in as the child of your control.
>> 					joe
>>
>> On 7 Jul 2006 09:47:03 -0700, "fernando.a.gomez.f@gmail.com"
>> <fernando.a.gomez.f@gmail.com> wrote:
>>
>> >Hi fellows. I have a CWnd-derived class that has two CStatic members,
>> >that are created dynamically.
>> >
>> >My question is simple: What must I do in order to receive messages of
>> >such members?
>> >
>> >This CWnd-derived class is for creating a custom control. This control
>> >needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
>> >and the other as the down arrow. I already placed them, now I need to
>> >receive the notification (the click notification).
>> >
>> >
>> >// in the header
>> >
>> >CStatic m_lblArrowUp;
>> >CStatic m_lblArrowDown;
>> >
>> >// in the Create method
>> >
>> >m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
>> >this, IDC_ARROWUP);
>> >m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
>> >rectDown, this, IDC_ARROWDOWN);
>> >m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
>> >m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
>> >
>> >
>> >Any clue will be really appreciated.
>> >
>> >Regards,
>> >FG.
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/11/2006 1:32:04 AM
Hi Joseph,

I know I could use a scroll bar, but for reasons I don't need to
explain (and that includes that I'm working under WinCE), I need to use
two CStatics. You say: "the confusion arose because you talk about two
custom controls". No, I never talked about two custom controls, I only
talked about one that contains two CStatic controls. I'm not deriving
anything from CStatic, I just create them dinamically and call
SetBitmap. That's it.

class CMyCustomCtl : public CWnd
{
private:
   CStatic m_static1;
   CStatic m_static2;

   CRect CalcRectUp() const;
   CRect CalcRectDown() const;
protected:
   DECLARE_MESSAGE_MAP();
public:
   BOOL Create(CRect& rect, CWnd* pParent, UINT nID)
   {
        BOOL bRet;

	bRet = CWnd::Create(_T("MyCustomCtrl"), _T(""),
		WS_VISIBLE | WS_CHILD, rect, pParent, nID);

	m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
SS_NOTIFY,
                CalcRectUp(), this, IDC_ARROWUP);
	m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
SS_NOTIFY,
                CalcRectDown(), this, IDC_ARROWDOWN);

        return bRet;
   }
};

Concerning about the scrollbar, it isn't enough to just create a
CScrollBar, because there are many features needed in the application
that WinCE does not support in its controls, and I have to simulate
them.

Finally, the wrong thing was that I was missing the SS_NOTIFY style
while creating the CStatic's.

Thanks for your time and comments.

Regards,
Fernando.

Joseph M. Newcomer wrote:
> BUt you could put a scrollbar inside a custom control trivially; just create it as the
> child control of your custom control!
>
> The confusion arose because you talk about two custom controls, and two controls derived
> from CStatic, and the association seemed to be 1:1.
>
> But if you need a scrollbar, just create it as a child control of your custom control, and
> in your custom control put the message map entries to handle it.  Unless you need some
> weird size control, this should work fine.  If you need some weird size control that can't
> be created from CScrollBar, then you can make the controls child controls of hte custom
> control, and siblings of the other controls inside the static control.  If you only need
> an up/down control, just use an up/down control, which you can resize to the size you
> need.  Note that the dialog editor has some weird behavior in terms of sizing, so when
> I've done this, I have to resize the control at runtime.
> 					joe
>
> On 10 Jul 2006 09:29:58 -0700, "fernando.a.gomez.f@gmail.com"
> <fernando.a.gomez.f@gmail.com> wrote:
>
> >
> >Hi Joseph,
> >
> >thanks for your interest.
> >
> >First, I need them to be created dynamically because they represent the
> >up and down arrow of a custom scrollbar within a custom control.
> >
> >Second, yes, I didn't specify the SS_NOTIFY, that was the mistake
> >indeed.
> >
> >Next, either I explained myself wrong or you didn't understand. I never
> >said I want some controls derived from CStatic, I said I'm creating a
> >custom control, derived from CWnd as any other custom control, that has
> >two members of type CStatic. I didn't show message map entries because
> >there was no need to.
> >
> >Thanks again for your comments.
> >
> >Regards,
> >FG.
> >
> >Joseph M. Newcomer wrote:
> >> If it has two members, why bother to create them dynamically?
> >>
> >> Note that you have not specifed SS_NOTIFY, so these static controls (they are not pure
> >> CWnd-derived as you suggest) will not generate any notifications at all.
> >>
> >> You have not shown any message map entries; you would need to create message map entries.
> >> Because you are deriving from CStatic, the messages you can get are limited.  Another
> >> solution would be to simply put a scrollbar control in as the child of your control.
> >> 					joe
> >>
> >> On 7 Jul 2006 09:47:03 -0700, "fernando.a.gomez.f@gmail.com"
> >> <fernando.a.gomez.f@gmail.com> wrote:
> >>
> >> >Hi fellows. I have a CWnd-derived class that has two CStatic members,
> >> >that are created dynamically.
> >> >
> >> >My question is simple: What must I do in order to receive messages of
> >> >such members?
> >> >
> >> >This CWnd-derived class is for creating a custom control. This control
> >> >needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
> >> >and the other as the down arrow. I already placed them, now I need to
> >> >receive the notification (the click notification).
> >> >
> >> >
> >> >// in the header
> >> >
> >> >CStatic m_lblArrowUp;
> >> >CStatic m_lblArrowDown;
> >> >
> >> >// in the Create method
> >> >
> >> >m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
> >> >this, IDC_ARROWUP);
> >> >m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
> >> >rectDown, this, IDC_ARROWDOWN);
> >> >m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> >> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
> >> >m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
> >> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
> >> >
> >> >
> >> >Any clue will be really appreciated.
> >> >
> >> >Regards,
> >> >FG.
> >> Joseph M. Newcomer [MVP]
> >> email: newcomer@flounder.com
> >> Web: http://www.flounder.com
> >> MVP Tips: http://www.flounder.com/mvp_tips.htm
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

0
7/11/2006 3:27:32 PM
I've built a lot of custom control bars as well; but usually, I just allocate a region of
screen space and implement my own OnLButtonDown handlers that look for PtInRect to decide
what to do.  I've found that too many times adding additional controls just adds pain
without functionality, so I try to avoid this when possible.
				joe

On 11 Jul 2006 08:27:32 -0700, "fernando.a.gomez.f@gmail.com"
<fernando.a.gomez.f@gmail.com> wrote:

>Hi Joseph,
>
>I know I could use a scroll bar, but for reasons I don't need to
>explain (and that includes that I'm working under WinCE), I need to use
>two CStatics. You say: "the confusion arose because you talk about two
>custom controls". No, I never talked about two custom controls, I only
>talked about one that contains two CStatic controls. I'm not deriving
>anything from CStatic, I just create them dinamically and call
>SetBitmap. That's it.
>
>class CMyCustomCtl : public CWnd
>{
>private:
>   CStatic m_static1;
>   CStatic m_static2;
>
>   CRect CalcRectUp() const;
>   CRect CalcRectDown() const;
>protected:
>   DECLARE_MESSAGE_MAP();
>public:
>   BOOL Create(CRect& rect, CWnd* pParent, UINT nID)
>   {
>        BOOL bRet;
>
>	bRet = CWnd::Create(_T("MyCustomCtrl"), _T(""),
>		WS_VISIBLE | WS_CHILD, rect, pParent, nID);
>
>	m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
>SS_NOTIFY,
>                CalcRectUp(), this, IDC_ARROWUP);
>	m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP |
>SS_NOTIFY,
>                CalcRectDown(), this, IDC_ARROWDOWN);
>
>        return bRet;
>   }
>};
>
>Concerning about the scrollbar, it isn't enough to just create a
>CScrollBar, because there are many features needed in the application
>that WinCE does not support in its controls, and I have to simulate
>them.
>
>Finally, the wrong thing was that I was missing the SS_NOTIFY style
>while creating the CStatic's.
>
>Thanks for your time and comments.
>
>Regards,
>Fernando.
>
>Joseph M. Newcomer wrote:
>> BUt you could put a scrollbar inside a custom control trivially; just create it as the
>> child control of your custom control!
>>
>> The confusion arose because you talk about two custom controls, and two controls derived
>> from CStatic, and the association seemed to be 1:1.
>>
>> But if you need a scrollbar, just create it as a child control of your custom control, and
>> in your custom control put the message map entries to handle it.  Unless you need some
>> weird size control, this should work fine.  If you need some weird size control that can't
>> be created from CScrollBar, then you can make the controls child controls of hte custom
>> control, and siblings of the other controls inside the static control.  If you only need
>> an up/down control, just use an up/down control, which you can resize to the size you
>> need.  Note that the dialog editor has some weird behavior in terms of sizing, so when
>> I've done this, I have to resize the control at runtime.
>> 					joe
>>
>> On 10 Jul 2006 09:29:58 -0700, "fernando.a.gomez.f@gmail.com"
>> <fernando.a.gomez.f@gmail.com> wrote:
>>
>> >
>> >Hi Joseph,
>> >
>> >thanks for your interest.
>> >
>> >First, I need them to be created dynamically because they represent the
>> >up and down arrow of a custom scrollbar within a custom control.
>> >
>> >Second, yes, I didn't specify the SS_NOTIFY, that was the mistake
>> >indeed.
>> >
>> >Next, either I explained myself wrong or you didn't understand. I never
>> >said I want some controls derived from CStatic, I said I'm creating a
>> >custom control, derived from CWnd as any other custom control, that has
>> >two members of type CStatic. I didn't show message map entries because
>> >there was no need to.
>> >
>> >Thanks again for your comments.
>> >
>> >Regards,
>> >FG.
>> >
>> >Joseph M. Newcomer wrote:
>> >> If it has two members, why bother to create them dynamically?
>> >>
>> >> Note that you have not specifed SS_NOTIFY, so these static controls (they are not pure
>> >> CWnd-derived as you suggest) will not generate any notifications at all.
>> >>
>> >> You have not shown any message map entries; you would need to create message map entries.
>> >> Because you are deriving from CStatic, the messages you can get are limited.  Another
>> >> solution would be to simply put a scrollbar control in as the child of your control.
>> >> 					joe
>> >>
>> >> On 7 Jul 2006 09:47:03 -0700, "fernando.a.gomez.f@gmail.com"
>> >> <fernando.a.gomez.f@gmail.com> wrote:
>> >>
>> >> >Hi fellows. I have a CWnd-derived class that has two CStatic members,
>> >> >that are created dynamically.
>> >> >
>> >> >My question is simple: What must I do in order to receive messages of
>> >> >such members?
>> >> >
>> >> >This CWnd-derived class is for creating a custom control. This control
>> >> >needs vertical scrollbar, so I'm using two bitmaps, one as de up arrow
>> >> >and the other as the down arrow. I already placed them, now I need to
>> >> >receive the notification (the click notification).
>> >> >
>> >> >
>> >> >// in the header
>> >> >
>> >> >CStatic m_lblArrowUp;
>> >> >CStatic m_lblArrowDown;
>> >> >
>> >> >// in the Create method
>> >> >
>> >> >m_lblArrowUp.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP, rectUp,
>> >> >this, IDC_ARROWUP);
>> >> >m_lblArrowDown.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP,
>> >> >rectDown, this, IDC_ARROWDOWN);
>> >> >m_lblArrowUp.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>> >> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_UPARROW)));
>> >> >m_lblArrowDown.SetBitmap(LoadBitmap(AfxGetResourceHandle(),
>> >> >MAKEINTRESOURCE(IDB_VERTICLE_SCROLLBAR_DOWNARROW)));
>> >> >
>> >> >
>> >> >Any clue will be really appreciated.
>> >> >
>> >> >Regards,
>> >> >FG.
>> >> Joseph M. Newcomer [MVP]
>> >> email: newcomer@flounder.com
>> >> Web: http://www.flounder.com
>> >> MVP Tips: http://www.flounder.com/mvp_tips.htm
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/11/2006 5:54:50 PM
Reply:

Similar Artilces:

how do i create an office data connection file
i want to call a parameterized data connection. i want to eventually put this in office sharepoint server 2007's data connection library. every time i open the connection file i have successfully created that connects to the db, it want me to pick a table. i can cancel out of that and change it to sql and say to use a procedure, but i can't save this file, and the "Edit Query..." and "Parameters..." buttons are disabled so i can't set parameters. why is it so hard to work with this thing? thanks ...

Time reg: Creating an Outlook Calendar appointment from the order
It would be a great feature when it comes to time registration, if it was possible from the Order View in the CRM Outlook client to draw an order directly into the Outlook Calendar, thereby using it for time registration. In that case, it should be possible to select which data fields would be transferred to the Outlook Calendar Appointment, enabling all sorts of time usage statistics. I'm quite certain many companies would benefit from such a feature. I know we would. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most...

moving messages from outlook express to outlook
I am trying to move messages from outlook express version 6 to outlook 2003. When I export from outlook express, there is no indication where the export file is stored. Is there a way to move messages or will I have to email them to myself? Thanks ...

Creating a chart with text not numbers
How do I create a chart that has text values (freshman, sophomore, junior, senior) instead of numbers (1, 2, 3, 4)? I have a column labeled "What is your class standing?" and below it is 166 rows where people selected "Freshman," "Sophomore," etc. I want to create a bar chart that counts how many people selected each of the four classes. Thanks, Alan First of all, you will have numbers to plot. The words are your category labels. Read how to turn a column of words like this into a histogram: http://peltiertech.com/Excel/Charts/Histograms.html - Jon...

C00D11B3 error message
I have been using Media player for years, now have ver. 11, in the past two day, I have had a problem if I go to player and play some music stored on the hard drive, it works. I f I attempt to play something on the internet I get the error and then it won't play anything until I reboot the system. I thought it was a firewall issue, but can't figure out what it would be. I also have checked connect to the internet override, without success. I have recently changed routers to a linksys with Network Magic set to basic. I have no idea what is causing the issue. -- J P...

Overrides vs. Messages
Hi I have a basic question about MFC. There are 4 sections in Properties windows -Properties -Events -Messages -Overrides For example: For CView class OnDraw is in overrides section. But OnDrawItem is in messages section. Why is it so? Some methods are in mesages section(handle with message map) some are virtual. What is the logic behind this separation? Thank you. In a nutshell, the override section give you access to the virtual function of that class, and the messages sections give you access to the messages that are not already mapped to a virtual function in that class. I hope that ...

Creating Emails (Recevied) with SDK
I've been trying to write a SDK program that will take a file of received emails and upload them to CRM. I need to do this programmatically and have multiple people in the to address (Data Migration Wizard only allows 1). I can create emails easily enough and create the emails. However, I cannot set incoming emails where the sender is a contact to closed and received. Has anyone tried this before? ...

option "send picture with messages"
Hi ... where can i find the "send picture with messages" option in MS Oulook 2007 ? in Outlook Express you can find this option send picture with messages" in Tools -> Option -> Send -> HTML Settings -> send picture with messages option .... BUT in Oulook 2007 i couldn't find it .. so canyou please where can find it .. Thank You That is a registry only option now. See http://www.msoutlook.info/question/72 -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downl...

Creating a Relationship Between Order Product (salesorderdetail) and Service Activity (serviceappointment)
Hi folks, We are using CRM 4.0 to run a consulting business. Its working pretty well but we want to simply the way we are doing some things. What we want to do is create an Order (salesorder) with multiple Order Products (salesorderdetal). So good so far. Next I want to be able associate each Order Product (salesorderdetail) with a Service Activity (serviceappointment), this representing that this billable line item in the order is actually going to be fulfilled as a consuting engagement. The problem is, I can't seem to be able to create an association between the Order Product (salesor...

ESM
Hi, I created some Public folders in OL 2003 before Xmas no problems as I am the administrator for the local domains server & Exchange admin. Today I tried to create additonal folders form my LAN XP machine but continually receive the error of: Unable to create the folder. You do not have sufficient permission to perform this operation on this object. See the folder contact or your system administrator. When I look at the folder properties in OL I see the folder contact is NT USER:S-1-5-21-606747145-1682526488-682003330-1109 but I have no idea who that is...or was more likely! If I then g...

Creating a list of info in A1 cell in multiple worksheets
How can I create a list of the info/contents in the A1 cell in multiple worksheets? I am trying to create a summary worksheet of the data from 90 worksheets and would like to be able to list the headers in the A1 cell vertically. 'Right click on the summary sheet tab, and paste in this macro. 'Edit where appropriate: Sub CreateSummary() 'Starting row for summary: i = 1 For Each Sheet In ThisWorkbook.Sheets If Sheet.Name <> Me.Name Then 'Control What column to place data in Me.Cells(i, "A").Value = Sheet.Range("A1").Value i = i + 1...

Viewing messages #2
When I get e-mail and try to view the messages, they never come up. Can someone help me? Not yet. State your Outlook version, the type of mail transport you are using, whether you are using a preview pane or opening the message, etc. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Wleef33 asked: | When I get e-mail and try to view the messages, they | never come ...

WindowProc: combobox messages problem
In my CControlBar I have overridden the virtual WindowProc. The combobox on the controlbar displays correct and behaves well in runtime. Now, I spent a couple of hours trying to get some messages that I need, using WindowProc. This is needed because CControlBar will pass everything on to the controlbar owner, and that's not what I want. WindowProc is my way to intercept those messages. I already found out that the messages are, ehm, weird: their numbers do not match on related defines in winuser.h. To give an example: WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is def...

Create Assembly Call
hi All, can the create assembly call under update entity be used to add a certain number of hours/days/months/years to a date. i am trying to do this workflow if variable 1 = yes then create a task update variable 1 sent = yes variable 1 date = execution time can i use the create assembly workflow to add x number of days to variable 1 date and show in variable 2 date. any advice would be helpful please. thanks heaps regards Ridhima If Variable 1 Date is a DateTime field in CRM, then yes. You can use the Add DateTime assembly to take the Value in the DateTime field (which would be t...

Historical Stock Status As of Date
This is a multi-part message in MIME format. ------=_NextPart_000_00A5_01C8845C.ADFC9B50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I'd like to know whether anyone has encountered an issue wherein the As = of Date that is printed in the Historical Stock Status Detailed by Item = does not follow the date as indicated in the report options screen. = Currently we are trying to print the said report but no matter what date = we put in, the As of Date that prints on the report is set to 30 Jan = 2008. Is there anything that we...

Multiple messages
Hi I am receiving the same messages a number of times to my outlook express mail box. Sometimes I have 5 or 6 of the same message. Does anyone know why this is, or how I can stop it? Thanks very much Try posting this in an Outlook Express news group - this is not one of them. Outlook is a part of Microsoft Office and is what this group supports. Outlook Express is a part of Internet Explorer and has its own news groups. You can also find some good Outlook Express information here: http://www.insideoutlookexpress.com/ --� Milly Staples [MVP - Outlook] Post all replies to the group...

Sorting messages by sender
I've recently changed from using Outlook 2003 on an old Celeron PC running Win 2k, to a new P4 machine with XP. On the old set-up, I could click on the 'From' column header to sort messages in a mail folder by sender, then start typing the name of the sender to quickly take me to the messages from that person. This was very useful and I used this feature regularly, although it only seemed to work for the first three characters of the name, the fourth character entered would then take the cursor to the first instance of a name beginning with this letter. This was fine as the firs...

Intelligent Message Filtering
Hi All, Just to say what a good product IMF is. All my Junk-Mail is archived in a local queue. My dream become true ! No more wasted time in explaining what a SPAM is...... Diego P Castro MCSE-MCSA-SPS8 Brasil ...

Error Message 0x8007007F
Clip organizer keeps giving this error message when opened: Error Message 0x8007007F It will not open or insert pictures!!! Would appreciate any and all help junk2bj@hotmail.com http://www.mvps.org/msauer/clip_organizer_support.htm -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com "BJ" <junk2bj@hotmail.com> wrote in message news:38ec01c42980$ce5312c0$a301280a@phx.gbl... > Clip organizer keeps giving this error message when > opened: > > Error Message 0x8007007F > > It will not open or insert pictu...

Error message #3
Hi, everyone, I open to MS Excel 97, the following error messages was shown on screen. 26146100: file format is not valid. Please help Thanks Jimmy Something that is being opened is causing trouble. It could be an addin checked in Tools|Addins or a file in your XLStart folder (or if you are using tools|options|General|"Alternate Startup File location", it could be in there.) (Not many use the alternate startup file location, so try erasing that value from that box in excel--don't delete the real folder. If that fixed it, you're done.) If not, your task will be to...

How to create a floating bar chart vertically not horizontally...
Hi, The technique is the same for both column and bar charts, which is to use a stacked chart and remove the formatting from the series used to 'float' your data. See Jon's explanation. http://peltiertech.com/Excel/Charts/FloatingColumns.html Cheers Andy Cristina wrote: -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info ...

Merge & Sort Dynamic Lists w/ Data Validation
First off, let me say thanks to the Excel Usenet community that has helped me over and over through these newsgroups. You are phenomenal. Question 1: I need to create a BOTH box that will dynamically pull names from both the "Chicago Office" & "Seattle Office" columns in my sheet. It is extremely preferable to do this without VB Script if possible to avoid the security warnings on opening the sheet. (Our IT department will not budge on this..) Detail: I have two lists of employees. Column A lists the Chicago Office employees. Column B lists the Seattle Office employee...

Tab causes CStatic-derived object to repaint!!
Hi, I derived a class named CGroupBox from CStatic. I am using it the following way: 1. I created a dialog (and its corresponding CDialog-derived class) using the resource editor 2. In the dialog, I created a group box. 3. I mapped the group box component to a CGroupBox member of the dialog's class using the Class Wizard. I did this so that I could override OnPaint() and give the group box a custom look. When the dialog comes up, the focus is set to an edit control. As soon as I hit the TAB key to switch to the next edit control, the group box's label gets repainted--only the label,...

How do I create a new macro in Outlook 2007?
Below is the macro, copied from MS Word, where it works perfectly! In Outlook I get all sorts of error messages and debugging, which I don't understand. Thanks for any help. Sub SafariCare() ' ' SafariCare Macro ' Macro recorded 6/4/2007 by Eva Wilson ' Selection.TypeText Text:= _ "Thank you for your participation in the SafariCare program! " Selection.TypeText Text:= _ " Attached are the program guidelines for your convenience. " Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text:= _ ...

Error message 0x800ccc13 #4
Does anyone know what error message #0x800ccc13 means. I get it when I hit the sned/receive button. I can send email through Outlook 2000 but I can't receive anything. The message says that a TCP/IP error occured while trying to send data to the serever. All of my server set up info appears correct. I appreciate any answers ...