15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Splitter with CRichEditView

Ken Miller -- kmiller@ccse.net
Monday, October 21, 1996

 Environment:  VC++ 4.0, Win95
 
 I am trying to create an app that utilizes a spillter that would allow one
 view of a file on the left and a different view (modified) of the file on
 the right.  I have the splitter ok, and I have the left pane (unmodified
 input file) done ok.  But the problem I am having is what exactly to do
 about the right pane.  I have found references on how to do two views for
 the same document, but I am using CRichEditView and Doc and have always
 read that the view goes with the document, one-to-one.  I would like the
 left pane to be just ASCII and the right pane to be RTF.  Right now I have
 the left pane as CRichEdit and am not sure if the right pane should be a
 completely separate doc/view or not.   I am simply setting the m_bRTF flag
 to ASCII for the left pane/view and didn't think I could do that for the
 right pane unless I used a completely sparate document.
 
 Could someone please help with the right approach and maybe some guidance
 on how to do this?  Any help would be greatly appreciated.
 
 Thanks in advance...Ken




Mike Morel -- mmorel@mushroomsoft.com
Tuesday, October 22, 1996

[Mini-digest: 3 responses]

I did something like this, with a CTreeView on the left and a =
CRichEditView on the right.  You can have more than one view on the =
CRichEditDoc, as long as one is a CRichEditView. There are a few things =
to keep in mind.  This is from an article about it in MFC For Yourself:
	Once all of this was straightened out, the two views began to =
peacefully co-exist.  The guidelines are:
	If you want a CRichEditView, your document must be derived from =
CRichEditDoc.
	If you have a CRichEditDoc-derived document, the first view created =
must be from CRichEditView.
	In every view besides the rich edit view, handle ON_UPDATE_COMMAND_UI =
for=20
		ID_OLE_VERB_FIRST to prevent improper casting of view pointers.

For that last guideline, that means you should disable the command =
ID_OLE_VERB_FIRST command for all other views, because the doc handles =
it and casts the active view improperly.

What kind of view is the other (ASCII) view - CEditView?  Have you =
figured out how to get the plain text from the RTF?  If not, I've got an =
example of that also.

Mike Morel
Mushroom Software
Home of MFC For Yourself
http://www.mushroomsoft.com/mushroom



----------
From: 	Ken Miller[SMTP:kmiller@ccse.net]
Sent: 	Monday, October 21, 1996 6:42 PM
To: 	mfc-l@netcom.com
Subject: 	Splitter with CRichEditView

 Environment:  VC++ 4.0, Win95
=20
 I am trying to create an app that utilizes a spillter that would allow =
one
 view of a file on the left and a different view (modified) of the file =
on
 the right.  I have the splitter ok, and I have the left pane =
(unmodified
 input file) done ok.  But the problem I am having is what exactly to do
 about the right pane.  I have found references on how to do two views =
for
 the same document, but I am using CRichEditView and Doc and have always
 read that the view goes with the document, one-to-one.  I would like =
the
 left pane to be just ASCII and the right pane to be RTF.  Right now I =
have
 the left pane as CRichEdit and am not sure if the right pane should be =
a
 completely separate doc/view or not.   I am simply setting the m_bRTF =
flag
 to ASCII for the left pane/view and didn't think I could do that for =
the
 right pane unless I used a completely sparate document.
=20
 Could someone please help with the right approach and maybe some =
guidance
 on how to do this?  Any help would be greatly appreciated.
=20
 Thanks in advance...Ken

-----From: Roger Onslow/Newcastle/Computer Systems Australia/AU

As I understand, a CRichEditView is a window/view containing a rich edit 
control, and it is this control (rather than the document) that contains the 
actual rich text.  To do the split with rich text on one side and ascii (or 
some other non-rich-text view) on the other, I'd look at having the other view 
ask the doc for a pointer to the rich edit view, then use that to ask for the 
actual text to display (so the document acts as a sort of proxy for getting the 
info you need).  If you want two rich-text-views of the same document, however, 
I think you're out of luck (or need to do a lot more work).

Hope this helps (and is correct)

Roger
-----From: Ian Pepper 

Hi Ken,

First off, you can have as many views on a document as you like. 
Therefore, you may use two CRichEditViews of the same document with no
difficulty.  The sample VIEWEX shipped with the compiler provides an
excellent example of how to do this.  It uses different view classesto
render the document in a splitter.  But, there is nothing to stop you
from using the same view class twice in your splitter.

Hope this clears up the confusion.

Ian

-------------------------------------------------------------------------
---------
Ian Pepper,                 Tel:    +353-1-6766188
Flexicom Ltd,               Fax:   +353-1-6766199
32 Leeson St Lwr,       URL:  http://www.flexicom.ie
Dublin 2,                     email:  ian@flexicom.ie
Ireland.
                 ________________  ~ ~
                ( _(#)____________}}}}

-------------------------------------------------------------------------
----------



Roger Onslow/Newcastle/Computer Systems Australia/
Thursday, October 24, 1996

>Thanks for the reply.  I think I am going to try using the CEditView and
>the CRichEditView with a single CDocument, instead of hte CRichEditDoc.

CRichEditView *requires* CRichEditDoc.  (This is what I have read from people 
doing similar things -- eg in DrDobbs a couple of months ago there was an 
article about having a split view with tree control on one side and view on 
another and the contortions that had to be done to accomplish this -- look up 
DrDobbs back issues if you have them.  I'll have alook myself when I've time 
and let you know).

Roger




| Вернуться в корень Архива |