I know the answer is simple, but... 
Author Message
 I know the answer is simple, but...

I Wizard-generated an SDI app.  The ONLY change I made was that I had the
view class derived from CEditView.  Works great.

Here's the problem.  It isn't very clear to me where I would go in to insert
my own paint code.  If I put something like pDC->TextOut(100,100,"Test"); as
the very last statement in CTestView::OnDraw() the text isn't displayed.

I figured out that the CTestDoc class is actually doing some of the view
work, for example:

void CTestDoc::Serialize(CArchive& ar)
{
 // CEditView contains an edit control which handles all serialization
 ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);

Quote:
}

This clearly paints a new document.  The contents of the file are sent to
the veiw in:

void CTestDoc::Serialize(CArchive& ar)
{
 // CEditView contains an edit control which handles all serialization
 ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);

Quote:
}

Doesn't this go agains the Doc/View concept?

What I'm really trying to do is write a program that will read an ASCII
comma-delimited file where each line is a record.  Each record has four
fields.  The comma-delimited file is generated by AutoCAD and it is to be
sent to a specialized label printer.  None of the fields can be greater than
32 characters.  My thought was to write a custome viewer where the file
would be shown and edited in it's native form.  Any field that's greater
than 32 characters I want to diplay in red.  I can then quickly scan a file,
manually edit anything that is red to shorten it (and as I edit it the text
would go back to black if less than 32 characters and send it to the
printer.

Any idea or an approach that I should consider?

-Martin

P.S.:  Yes, I can do most of this in AutoLISP within AutoCAD but I thought
I'd use this simple project to get back into MFC learning mode.



Fri, 21 Dec 2001 03:00:00 GMT  
 I know the answer is simple, but...

Quote:

>I Wizard-generated an SDI app.  The ONLY change I made was that I had the
>view class derived from CEditView.  Works great.

>Here's the problem.  It isn't very clear to me where I would go in to insert
>my own paint code.  If I put something like pDC->TextOut(100,100,"Test"); as
>the very last statement in CTestView::OnDraw() the text isn't displayed.

CEditView is a wrapper for CEdit, i.e. a standard Windows edit control, and
it doesn't support user drawing of any kind, at least not in a satisfactory
way.

Quote:
>I figured out that the CTestDoc class is actually doing some of the view
>work, for example:

>void CTestDoc::Serialize(CArchive& ar)
>{
> // CEditView contains an edit control which handles all serialization
> ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
>}

>This clearly paints a new document.  The contents of the file are sent to
>the veiw in:

>void CTestDoc::Serialize(CArchive& ar)
>{
> // CEditView contains an edit control which handles all serialization
> ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
>}

>Doesn't this go agains the Doc/View concept?

There's not much to do about it. An edit control maintains its own data, so
when using CEditView, the view contains the data, not the document.

Quote:
>What I'm really trying to do is write a program that will read an ASCII
>comma-delimited file where each line is a record.  Each record has four
>fields.  The comma-delimited file is generated by AutoCAD and it is to be
>sent to a specialized label printer.  None of the fields can be greater than
>32 characters.  My thought was to write a custome viewer where the file
>would be shown and edited in it's native form.  Any field that's greater
>than 32 characters I want to diplay in red.  I can then quickly scan a file,
>manually edit anything that is red to shorten it (and as I edit it the text
>would go back to black if less than 32 characters and send it to the
>printer.

>Any idea or an approach that I should consider?

Richedit controls support color text, but it sounds like you might want to
use a grid control.

--
Doug Harrison

Visual C++ MVP



Sat, 22 Dec 2001 03:00:00 GMT  
 I know the answer is simple, but...

Quote:
> CEditView is a wrapper for CEdit, i.e. a standard Windows edit control,
and
> it doesn't support user drawing of any kind, at least not in a
satisfactory
> way.

After reading through the CEditView source I realized that I was destined to
fail the minute I selected this class for my view.

-Martin



Sun, 23 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Simple question ( for those how knows the answer )

2. Simple problem across processes - need simplest answer

3. Pls answer me, I am online

4. I am seachcing a free pascal editor if someone known a web site just called me

5. How to know whether i am connected

6. how to know whether i am connected

7. How do I know when I am connected?

8. simple question, but I am stuck.

9. I am a retard (perhaps a simple problem??)

10. a very simple problem about # include files but i am a beginer

11. Simple Question I am sure !!!!!

12. EventLog question (nobody knows the answer)

 

 
Powered by phpBB® Forum Software