Changing style of a subclassed CEdit

I'am using a subclassed CEdit in a CComboBox and have a CEdit derived class for that. For the edit control I want to set the ES_NOHIDESEL style.
Unfortunately PreCreateWindow() or OnCreate() are never called by a subclassed control and so I don't know, how to set the style. ModifyStyle() doesn't work with ES_NOHIDSEL.
I also would agree to another solution than subclassing for using an own edit control in a combobox.

Thanx for your help.
LVL 3
_mb_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amritpal SinghCommented:
0
AndyAinscowFreelance programmer / ConsultantCommented:
override the virtual function PreSubclassWindow and modify the style there (in your edit class).
The OnCreate and PreCreate have already been called by the time you perform the subclassing hence you never get them them in your class.
0
_mb_Author Commented:
Hi amrit_82,
I know these article. It doesn't give an answer to my question.

Hi AndyAinscow,
to change it in PreSubclassWindows also was my idea, but I don't know how. There is no CREATESTRUCT parameter, that I can modify and ModifyStyle() doesn't work.




0
AndyAinscowFreelance programmer / ConsultantCommented:
Excerpt from help

Edit Control Styles
To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.

ES_NOHIDESEL is one that can't be changed after creation.

As I see it you have two possibilites.
1) Create the control with the ES_NOHIDESEL style.
2) Instead of subclassing, get the control styles, ID, position, visibility etc.  Delete edit control. Create your own to replace the one you deleted and set styles, content, visibility ...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
_mb_Author Commented:
AndyAinscow, thanx for your help. I deleted the current control and created a new one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.