Solved

Drawing on top of a listbox

Posted on 1997-02-22
1
446 Views
Last Modified: 2013-11-20
I have created a custom class derived from CListCtrl.  I want to have a standard entry field (CEdit) on top of one of the rows in the ListCtrl.  I will be hiding/showing it from time to time.  Sort of mimic'ing the cool in-place editing feature of the directory listbox for MSVC's options box.

I have been able to draw and show the edit field just fine, however if the CListCtrl needs to be repainted (let say a window covered it up for a second), the CEdit field gets painted first and then the CListCtrl paints over it.  All I see is a blinking caret when the window is done repainting.  It seems this is the order in which MFC paints the controls.  
Here is what I have tried:

1)  I have flagged the CListCtrl as transparent.  Funny thing, the on-line help says transparent windows will get called last, huh?  That doesn't make sense.

2)  OnPaint message for custom CListCtrl.  -- Doesn't work.  Everytime I update the window (i.e. draw something on top of it) it loops endlessly (like it wants to repaint it again and again because of my painting on top).

Is what I am doing possible?  I really don't want to draw the listbox and everything relating to it myself, I just want to paint something on top and use the listctrl as a normal listctrl.

Is this possible?

Tom
0
Comment
Question by:tdietz
[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
1 Comment
 

Accepted Solution

by:
YZ earned 100 total points
ID: 1300286
First, CEdit object should be the child of CListrCtrl object.
Then, you should not send any invalidate messages to edit, it would be updated when it neccessary to windows. Forget about transparency - there is nothing common to the problem you got.
And the next, if your CEdit using some yours class subclassed from stabndard "EDIT" (RegisterWindowClass....), then check if your class does not have style CS_PARENTDC.
That should help.

BTW. I did the same thing with my own CListBox
derived class in Win3.X/95, and got no problems with this. Ask me if you want some sources.
0

Featured Post

Industry Leaders: 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
How to create frequencies of a variable from SAS dataset? 10 139
Looking for a specific application/software 2 119
Excel file not created as expected 7 94
Message not shown 5 87
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‚Ķ
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.

730 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