Some help to derive from CListBox to add UpDown control
- From: mosfet <richom.v@xxxxxxx>
- Date: Mon, 26 Mar 2007 13:39:05 +0200
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.
So I am starting with that :
//---------------------------------------------------------------------------//
// PORT CSpinListBox From WTL
//---------------------------------------------------------------------------//
class CxSpinListBox : public CListBox
{
DECLARE_DYNAMIC(CxSpinListBox)
// Constructors
public:
CxSpinListBox();
//overrides
virtual void PreSubclassWindow();
// Message map functions
protected:
//{{AFX_MSG(CCheckListBox)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
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 ?
What I want to do is to have one control that encapsulates my two controls ListBox and CSpinButtonCtrl because I want to be able to do that :
m_spinxFoo.MoveWindow(...) // move CxSpinListbox control at position ...
and not
m_lstFoo.MoveWindow(...) //move listbox at position ...
m_spinFoo.MoveWindow(...)//move updown control to the right of listbox ...
.
- 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
- From: Scott McPhillips [MVP]
- Re: Some help to derive from CListBox to add UpDown control
- Prev by Date: How to Disable current menu and Show another menu
- Next by Date: RE: VB ActiveX to VC 2005
- Previous by thread: How to Disable current menu and Show another menu
- Next by thread: Re: Some help to derive from CListBox to add UpDown control
- Index(es):