[comp.windows.ms.programmer] Subclassing

kevin@msa3b.UUCP (Kevin P. Kleinfelter) (03/22/91)

I'd like to create a "browse" window.  This window would act
exactly like a multiline edit control, with two exceptions:
   1. The user could not modify or select any data
   2. The program could add text to the window (with an edit control,
      it appears that the program can only SET the text, and I'd like
      to add a line, add another line, etc.)

I THINK that this suggests I should subclass multiline edit.
In my subclass function, I could pretty easily handle #1 above, by ignoring
the messages that would modify or select the data.  I don't see how to
do #2; how can I add text?  The only way I can think of is to
get all the text from the edit control into a buffer, concatenate
my text onto the end, and then set the text of the edit control.
Is there a better way?


-- 
Kevin Kleinfelter @ Dun and Bradstreet Software, Inc (404) 239-2347
...gatech!nanovx!msa3b!kevin
Warning: There seem to be multiple 'msa3b' nodes on Usenet, and it is
nanoVX, not nanovAx.

curt@cctb.wa.com (Curt Johnson) (03/23/91)

In article <1580@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes:
|    2. The program could add text to the window (with an edit control,
|       it appears that the program can only SET the text, and I'd like
|       to add a line, add another line, etc.)
| 
| I don't see how to
| do #2; how can I add text?  The only way I can think of is to
| get all the text from the edit control into a buffer, concatenate
| my text onto the end, and then set the text of the edit control.
| Is there a better way?

I have an idea, it's probably not better, but may be easier.

Send WM_CHAR messages to the edit control to add each character.
It should not take too long if you aren't adding too many characters.

Another thing you could consider if the data is really line oriented
is using a list box.



#if SILLY_EXAMPLE_THAT_ALMOST_RELATES_TO_CURRENT_QUERY

I once wrote code to make a multiline edit control on the Macintosh
a list box (before list boxes were available).

#endif


Curt Johnson == curt@cctb.wa.com