Solved

Painting/Drawing problems

Posted on 1998-03-23
3
490 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

16 Experts available now in Live!

Get 1:1 Help Now