Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Overriding the Edit Control in a CListCtrl

120 views
Skip to first unread message

Simon Fogg

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

Does anyone know how to substitute the Edit control within a CListCtrl with
a user defined version?

I have produced a CIPEdit class ( Similar to the IP Address Edit control in
the Windows 'NT / 95 control Panel ). I would like to allow in - place
editing within a CListCtrl using this new Edit Control Class. I am however
having problems replacing the default CEdit control used by the CListCtrl
component.

Any suggestions welcome.

Simon Fogg.

simon...@vicomtech.com

Alexander Galkin

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

Simon Fogg wrote in message ...

Handle NM_CLICK WM_NOTIFY message sent to parent of list control, inside
this handler call CListCtrl::EditLabel. This function returns pointer to
created edit control. Then you can subclass
it with SubclassWindow and handle message in your CEdit derived class.

Alternatively you can create your own edit. Look at "code guru" site at
http://www.codeguru.com/listview/drop_down_list.shtml, there is a sample
which
shows how to create combobox on subitem. You should slightly modify code to
create your own edit
instead of combo.

Alexander Galkin
Software Engineer
Zebra Pushware Solutions, Inc.
E-mail: sa...@zsoft.com
WWW: http://www.infopager.com

Jim Ross

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

"Simon Fogg" <simon...@vicomtech.com> wrote:

> Does anyone know how to substitute the Edit control within a CListCtrl with
> a user defined version?

From the online docs (Tree Control Label Editing)
========================
During label editing, typically in response to the TVN_BEGINLABELEDIT
notification message, you can get a pointer to the edit control used for label
editing by using the GetEditControl member function. You can call the edit
control's SetLimitText member function to limit the amount of text a user can
enter or subclass the edit control to intercept and discard invalid
characters. Note, however, that the edit control is displayed only after
TVN_BEGINLABELEDIT is sent.
==================

In your OnBeginlabeledit you can use GetEditControl() to get a pointer to the
edit control which you can then use to subclass the control.


Jim [VC/MFC MVP]
To send mail, change nospam to msn


0 new messages