Re: Some help to derive from CListBox to add UpDown control
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Mon, 26 Mar 2007 11:10:07 -0400
mosfet wrote:
Hi,
I am developping on Smartphone with MFC(next time I will use WTL because it's more appropriate) and I would like to create a control deriving from a CListBox and that add a Updown control.
Actually I want to create the updown control dynamically so that when
I move my control arrows also move.
First I wanted to use the WTL CSpinBox control from MFC (http://www.codeproject.com/wtl/mix_wtl_mfc.asp) but I always got some errors so I have decided to stick with standard MFC for this project.
What I want is to put some CListBox on my dialog in the resource editor
and to declare a class CxSpinListBox that subclass these controls.
It means when they subclass them and they dynamically create a Updown control at their right.
...
but after I don't know exactly what method I should override.
OnCreate or Create?
PresubclassWindow?
I think I would go with PreSubclassWindow and try to dynamically create a UPDOWNCLASS control but after when I will click on arrow keys how can I be notified ?
Should I include a CSpinButtonCtrl inside my class to handle msgs ?
PreSubclassWindow in the CListBox is the place to create your spinner control. Create it as a child of the list box so it will move with the list box and send notifications to the list box.
You can receive notifications from the spinner control by putting ON_CONTROL_RANGE or ON_COMMAND_RANGE in the message map of the parent list box. When you create the spinner dynamically you assign an ID to it in the Create function, then use that same ID (range of IDs) in the message map macros to handle the messages from the spinner.
--
Scott McPhillips [VC++ MVP]
.
- Follow-Ups:
- Re: Some help to derive from CListBox to add UpDown control
- From: Joseph M . Newcomer
- Re: Some help to derive from CListBox to add UpDown control
- References:
- Prev by Date: Re: Exception breakpoint 0x80000003
- Next by Date: Re: VS 2005 Standard or Pro?
- Previous by thread: Some help to derive from CListBox to add UpDown control
- Next by thread: Re: Some help to derive from CListBox to add UpDown control
- Index(es):