Solved

CComboBox Read-Only

Posted on 2003-11-04
8
369 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 300 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
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!

 
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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 51
unable to delete all specified values regedit 38 895
fizzArray  challenge 1 115
Notepad++ Question 11 28
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

751 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