Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing style of a subclassed CEdit

Posted on 2004-10-29
5
Medium Priority
?
494 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:_mb_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12443293
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 12443968
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
 
LVL 3

Author Comment

by:_mb_
ID: 12447894
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
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 1600 total points
ID: 12462187
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
 
LVL 3

Author Comment

by:_mb_
ID: 12471516
AndyAinscow, thanx for your help. I deleted the current control and created a new one.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question