Solved

CComboBox Read-Only

Posted on 2003-11-04
8
336 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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 300 total points
Comment Utility
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
Comment Utility
To remove the blinking caret, once you have the edit window,

pEdit->HideCaret() ;
0
 
LVL 23

Expert Comment

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

Rosh :)
0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
Maybe all you need is dropdown list style (just a guess...)
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:SGyves
Comment Utility
OMG!!! Alex....you are absolutely right.....LOL
0
 

Author Comment

by:SGyves
Comment Utility
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
Comment Utility
Well... I should learn to give direct answers.
0
 

Author Comment

by:SGyves
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now