Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CComboBox Read-Only

Posted on 2003-11-04
8
Medium Priority
?
414 Views
Last Modified: 2013-11-20
Ok...I know that you can get the child window of the combo box and set it to read only. But how do I make it so the box is still white and not gray. Also...I do not want to se the blinking caret in the window.
0
Comment
Question by:SGyves
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 1200 total points
ID: 9684159
Map WM_CTLCOLOR, dialog will sent this message for this EDIT as *STATIC* (only when disabling an EDIT)

Try this code

HBRUSH CTestPrograms_DLGDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
      HBRUSH hbr;
      
      if ( nCtlColor == CTLCOLOR_STATIC )
      {
            hbr = (HBRUSH)GetStockObject(WHITE_BRUSH);
      }
      else
      {
            hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
      }
            
      // TODO: Return a different brush if the default is not desired
      return hbr;
}

You can check the window pointer or ID for coloring  specific read only edit.

I'm checking the Blinking caret issue

Good Luck
0
 
LVL 9

Expert Comment

by:Priyesh
ID: 9684179
To remove the blinking caret, once you have the edit window,

pEdit->HideCaret() ;
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9684213
addition to Priyesh's comment:
map EN_SETFOCUS and there also call "HideCaret()"

Rosh :)
0
Independent Software Vendors: 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!

 
LVL 48

Expert Comment

by:AlexFM
ID: 9684558
Maybe all you need is dropdown list style (just a guess...)
0
 

Author Comment

by:SGyves
ID: 9684593
OMG!!! Alex....you are absolutely right.....LOL
0
 

Author Comment

by:SGyves
ID: 9690146
Although all I needed was what AlexFM suggested...I will give the points to rosh for the most direct answer to the question. Thanks.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9692492
Well... I should learn to give direct answers.
0
 

Author Comment

by:SGyves
ID: 9695303
No...no...that was not my point at all....I hope you are not offended...I really appreciate your answer....I am sorry for not giving the points to you.
0

Featured Post

Independent Software Vendors: 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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

705 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