Solved

Painting/Drawing problems

Posted on 1998-03-23
3
500 Views
Last Modified: 2013-11-19
I don't really know the difference between what WM_PAINT does and what WM_DRAW does, and this is
causing some trouble. I have an application with a CEditView and I have a string of text that I am trying to
print to it. I would like the screen to be cleared before I print a new string. I tried to do this by using
GetEditCtrl().SetWindowText (NULL), but the text disappears immediately after printing. I  am using GetEditCtrl().SetSel and ReplaceSel to print the text. I think this has something to do with the window painting,
 but i don't know how to stop this.

I think this probably has an easy answer. If it turns out not to, I will offer more points.
0
Comment
Question by:horn
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1317162
It's a very easy answer: the difference between WM_PAINT and WM_DRAW is that WM_PAINT exists while there's no such thing as WM_DRAW.

Calling SetWindowText(NULL) will clear the window of all text.  If you want to erase all of what's in the control, just call SetWindowText() with the text you want to place in the control. The text you place in there will erase what used to be there.

If you use SetSel() and ReplaceSel(), you can have more control over what happens to the text that's already in the control--you can add to the beginning or add to the end, for example.

.B ekiM
0
 

Author Comment

by:horn
ID: 1317163
OK, I didn't know about the non-existence of WM_DRAW. No wonder I couldn't find it
anywhere in the docs. FYI I *have* tried reading the online documentation -- but a lot of
it is non-intuitive, and pretty disorganized. I guess I should go buy Petzold or something.

Thanks.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1317164
If you use the very fine full-text search commands and turn up nothing, you can be certain it doesn't exist.

.B ekiM

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 95
Expand data scrubbing tool 13 36
ShiftLeft challenge 21 88
Remove Password Protection from pdf (with password) using an command line executable 5 77
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…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 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