OnDraw() not called in derivative of CEditView (MDI documents)

VC++ 6.0; MFC; MDI

In the function OnDraw(...) I would like to change the font of the EditView. 
The overloaded function OnDraw(...) is never called. Only the function 
OnUpdate(...) is called. So I stepped through the MFC. In WINFRM.CPP the 
message WM_INITIALUPDATE is sent to all views.
Is it possible that during OpenDocumentFile() no _DRAW message is sent?
Do I have to send this message?
Other solutions?

//////////////////////////////////////////////////////////////////
// Dialog:
class CTxtDlg : public CEditView
{
protected:
	virtual void OnDraw(CDC* pDC);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
....
};

void CTxtDlg::OnDraw(CDC* pDC) {
}
void CTxtDlg::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) {
}

//////////////////////////////////////////////////////////////////
// MainFrame:
BOOL CTest8085App::InitInstance() {
....
	CMultiDocTemplate* pTxtDocTemplate;
	pTxtDocTemplate = new CMultiDocTemplate(
		IDR_TXTSTR,
		RUNTIME_CLASS(CTxtDoc),
		RUNTIME_CLASS(CMDIChildWnd),
		RUNTIME_CLASS(CTxtDlg));
	AddDocTemplate(pTxtDocTemplate);
	
	// open document
	m_pDocLog = (CTxtDoc*)pTxtDocTemplate->OpenDocumentFile(strLogName);
....
}
0
5/5/2006 8:14:01 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1042 Views

Similar Articles

[PageSpeed] 27

OnDraw():
MSHelp: Called by the framework to render an image of the document,...
CEditView only supports text. Would be a good reason why OnDraw() is not 
called. I changed the font in the function OnCreate() (WM_CREATE).

I really have to read the specification more precisely.
0
5/5/2006 8:53:01 AM
OnDraw is irrelevant for CEditView, because the actual drawing is done in the embedded
CEdit control.  So there will never be anything to draw!

Just call SetFont on the embedded edit control (GetEditCtrl(), I think, but check the docs
on CEditView) to change the font.
				joe

On Fri, 5 May 2006 01:14:01 -0700, Pfister Harald
<PfisterHarald@discussions.microsoft.com> wrote:

>VC++ 6.0; MFC; MDI
>
>In the function OnDraw(...) I would like to change the font of the EditView. 
>The overloaded function OnDraw(...) is never called. Only the function 
>OnUpdate(...) is called. So I stepped through the MFC. In WINFRM.CPP the 
>message WM_INITIALUPDATE is sent to all views.
>Is it possible that during OpenDocumentFile() no _DRAW message is sent?
>Do I have to send this message?
>Other solutions?
>
>//////////////////////////////////////////////////////////////////
>// Dialog:
>class CTxtDlg : public CEditView
>{
>protected:
>	virtual void OnDraw(CDC* pDC);
>	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
>...
>};
>
>void CTxtDlg::OnDraw(CDC* pDC) {
>}
>void CTxtDlg::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) {
>}
>
>//////////////////////////////////////////////////////////////////
>// MainFrame:
>BOOL CTest8085App::InitInstance() {
>...
>	CMultiDocTemplate* pTxtDocTemplate;
>	pTxtDocTemplate = new CMultiDocTemplate(
>		IDR_TXTSTR,
>		RUNTIME_CLASS(CTxtDoc),
>		RUNTIME_CLASS(CMDIChildWnd),
>		RUNTIME_CLASS(CTxtDlg));
>	AddDocTemplate(pTxtDocTemplate);
>	
>	// open document
>	m_pDocLog = (CTxtDoc*)pTxtDocTemplate->OpenDocumentFile(strLogName);
>...
>}
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
-- 
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
0
newcomer (15975)
5/6/2006 4:11:58 AM
Reply:

Similar Artilces:

ReadOnly Visio Document
Hi, I would like to lock a visio document so it can't be modified by th user. How can i write that in my Vb code? I've tried something like that : intRead = Visio.ActivePage.Document.ReadOnly intRead = True but it didn't work! pleaz help! thanx Avalon2 -- avalon2 ----------------------------------------------------------------------- avalon27's Profile: http://www.officehelp.in/member.php?userid=18 View this thread: http://www.officehelp.in/showthread.php?t=69035 Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index...

Seperate document for Splitter views
Hi My app shows 2 graph views seperated by a splitter. The base graphview class is the same say CGraphView if i use splitter.CreateView(0,0,RUNTIME_CLASS(CGraphView)... splitter.CreateView(0,1,RUNTIME_CLASS(CGraphView)... they both use the same document class but i need them to show graphs frm different docs if i make 2 objects of the CGraphView how can i use the objects as CRuntimeClass*??? is there any other solution. rgds fordge fordge wrote: > Hi > My app shows 2 graph views seperated by a splitter. > > The base graphview class is the same say CGraphView > > if...

highlight changes in document approvals in hr self-service suite
Business Portal should highlight the changes that were made in employee self-service requests when displaying them to the approver. For instance, if an employee changes his or her address, highlight the new address so that the approver can easily verify its accuracy. I have delivered training on the HR Mgmt suite several times and that request has come up each and every time. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If y...

How to generate different series of document nos for different users..
We would like GP 8.0 to auto-generate different document numbers for each user. For example: User A will be assigned INV document numbers 1-100 and User B will assigned INV document numbers 101-200 and so on. Is that possible in GP 8.0? If so, how do I go about it? Any ideas? Thanks very much in advance for you help. -Surendra It would have to be a customized solution. VBA or Dexterity are your best bets, for now. With GP 9 you will be able to use Visual Studio 2005 to create customizations, too. "Surendra" wrote: > We would like GP 8.0 to auto-generate different do...

MFC explicit call to RegisterClassW
I'm trying to build the MFC library with a change: all calls to RegisterClass* become RegisterClass*W so that the apps that use this library will answer "true" to the IsWindowUnicode call (even though I'm building these apps *without* the _UNICODE flag--don't ask why I'm not wanting to set that compiler define; I'm constrained against setting it and making this a true Unicode app). Anyway, according to the help, if you register a window class using the *W function, then those windows should answer "true" to the IsWindowUnicode message and therefo...

How can do you FAX a Word document in Word 2007 64 bit mode?
Tried to send a Word document via Internet FAX service. Dialogue box pops up saying that option is not abvailable in 64 bit mode. Is there any way to FAX documents from Office 2007? Sage words appreciated. If you have a fax modem and install fax software compatible with your version of Windows (Windows XP and some versions of Vista include fax software that is not installed by default - others will need third party software) you can fax directly from the PC by 'printing' to the fax software driver - http://www.gmayor.com/fax_from_word.htm -- <>>< ><...

Preview pdf document
When I receive a document with a pdf attachtment I would like to preview this attachment in the reading pane without opening it. Is this possible? Greetz, Maarten No. At some point in the future you will be able to with Outlook 2007 and the proper filters installed. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips: http://www.outlook-tips.net/ Outlook & Exch...

help! trying to paste in document in spanish, pub cant hyphenate t
hello! ive been trying and trying to paste in a document i wrote using word. the doc is in spanish, and pub keeps popping up a window every 2 SECONDS (which is really annoying) saying it can't hyphenate the text. im not very computer savvy so i dont even know what that means! is it like hy-phanate? i dotn even want it to do that! it says i need to download something from the disc, which of course i no longer have. why can i do it in english with no problem? im using pub 2000 by the way. PLEASE HELP!!!!!! thank you! What version of Publisher are you using as different versions have the Hyp...

Help: Can't display contents of Adobe Acrobat Document in Sheet
Hoping that someone can help with this. I'm trying to insert an Adobe Acrobat document into an Excel worksheet. I'd like to see the document contents, not an Icon. According to the Excel help files, it should be possible to display the file as it shows up in Acrobat but no matter what I do, I see only an Icon. I went through the procedure listed in the help files to convert the document (ensuring that "show as an Icon" is not checked) but nothing makes any difference! Any idea what I'm doing wrong? When I try this with other document types (eg AutoCad) everythi...

importing excel and word documents from pc to mac
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) How can I import all files at one time without having to import files one at a time? On Tue, 19 Jan 2010 13:19:17 -0800, inc_brc@officeformac.com wrote: >Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) How can I import all files at one time >without having to import files one at a time? If your machines aren't on the same LAN, copy the directory to a RAM drive, to your iPod, or to a network drive, and then copy them from there to your Mac. That's what I do. -- "In no part of th...

Document window seems frozen...
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Hi everybody, <br><br>I'm new to this forum. I've got a problem that started this morning...For all Office apps, I cannot change the size of the window by grabbing and dragging the lower right hand corner of the window. The window other works fine and I'm able to interact with the application. Not an issue with anything else on the machine. Also, Word opens a doc with a very small window. Can I reset it to be full size on open and if so, how? <br><br>Thanks for your help! Hmm...

explicit call to ~CMDIChildWnd
In VS 2005, what is the reason an explicit call to ~CMDIChildWnd in the destructor of a derived class causes _CrtIsValidHeapPointer assertion? On Tue, 26 Jun 2007 21:46:09 GMT, "VCPP" <no_vcpp_spam@sbcglobal.net> wrote: >In VS 2005, what is the reason an explicit call to ~CMDIChildWnd >in the destructor of a derived class causes _CrtIsValidHeapPointer assertion? When you call a base class dtor in that context you end up double-destructing the object. You must not do this, because the compiler arranges for all dtors to be called in the reverse order of construction....

merging excel document
Excel Document has date 8/05/1953 when merged into Publisher it is 5/08/1953. How do I get it to stay 8/05/1953 when merged? Format the field text. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Shirl" <Shirl@discussions.microsoft.com> wrote in message news:05AFD28C-BF06-4308-AAA9-CE38275CFC05@microsoft.com... > Excel Document has date 8/05/1953 when merged into Publisher it is 5/08/1953. > How do I get it to stay 8/05/1953 when merged? Have Formated Date column in Excel. Seems to change in Mail Catalog M...

excel 2007 show number of recent documents
Recent documents are not displayed. When I go into Excel Options to Display - "Show this number of recent documents" 'the number field is grayed out. How do I set it? Is there currently a value in the feild?, try clicking the information icon next to it for help! -- The Code Cage Team Regards, The Code Cage Team http://www.thecodecage.com ------------------------------------------------------------------------ The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=31273...

Send a document image to Excel
Using Office Tools/Document Imaging, is it possible to send the image of the data (in rows & columns) and have it recognized in Excel? It is possible to OCR the text, save the text file, open the text file in excel. Yes, to the limits of your OCR application. Gord Dibben Excel MVP On 8 Aug 2005 07:26:01 -0700, "Matt Monaghan" <mmonaghan@softfile.com> wrote: >It is possible to OCR the text, save the text file, open the text file >in excel. ...

Getting calling Exe's name
I expected System.Reflection.Assembly.GetCallingAssembly().GetName().Name; to give me the name of the exe calling a c# class library. It isn't - the c# class library is a COM interrop dll and the calling exe is a Win32 Exe. What am I doing wrong, any ideas? Hello, Likely because a win32 exe file is not an assembly... Perhaps by getting the current process ? -- Patrice "AA2e72E" <AA2e72E@discussions.microsoft.com> a écrit dans le message de news:D88666E4-9E8B-404B-8930-AFA3B050B0C0@microsoft.com... >I expected > > System.Reflection...

Clear XP recent documents programatically
Is there a way to programatically clear XP recently opened documents list? "gargoyle60" <gargoyle60@example.invalid> wrote in message news:njbi161rgepkrghm57ekfu91cukj2c64di@4ax.com... > Is there a way to programatically clear XP recently opened documents list? If not, you can set Recent Documents not to display on Start Menu and delete from desktops any shortcut to this record. TweakUI may be the simplest method. -- Don Phillipson Carlsbad Springs (Ottawa, Canada) Simply delete the shortcuts in the Recent Documents folder. A bat file running in the ...

Excel 2002
Hello, I've got a problem with formatting changes not updating in linked document... Simply put, if you have a document that has a linked cell to another worksheet, the formatting ie...COLORS doesn't change when you change the source document with the linked document??? Yes, for instance text will be updated... but again, not formatting like making it BOLD or changing the colors of the text! Any ideas... I did see a KB article 1009182 regarding a problem linking WORD with Excel... but not Excel with Excel and the formatting not holding... it possibly is the case with Excel to Excel ...

Inserting Acrobat file in my Word document only inserts the first
In Word 2007, I clicked Insert Object, selected Adobe Acrobat Document, browsed for the document, clicked save, and noticed that only the first page of the Acrobat document gets pasted into my Word file. How can I get all 15 pages in my Word file? Thanks, Rhodesmk In Acrobat, you would separate the pdf into 15 separate files, and in Word you would Insert each one separately. On Dec 4, 11:43=A0am, rhode...@swbell.net <rhodesmkswbell...@discussions.microsoft.com> wrote: > In Word 2007, I clicked Insert Object, selected Adobe Acrobat Document, > browsed for the d...

word document date
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I'm trying to create an invoice for last month + I cannot stop word from automatically inserting today's date. This occurs in a template I downloaded from microsoft. Go to Insert menu choose Date and time choose desired format and make sure that automatically update is unchecked. > Go to Insert menu choose Date and time choose desired format and make sure that automatically update is unchecked. <br><br>Thank you. ...

Service Call Dispatch sort options
The service call dispatch board needs some additional sort options. For example call priority and call number. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=567f0968-f08...

Background of CStatic derived-class
I have a CStatic derived-class to draw text with color and what not. The simplified code for OnPaint() looks as follows: ----------------------------- CPaintDC dc(this); // device context for painting CRect rClient; GetClientRect( &rClient ); int iSavedDC = dc.SaveDC(); UINT nMode = dc.SetBkMode( TRANSPARENT ); COLORREF crPrevText = dc.SetTextColor( m_crText ); CFont* pOldFont = dc.SelectObject( m_pFont ); dc.DrawText( m_csText, &rClient, DT_VCENTER | DT_SINGLELINE ); dc.SetBkMode( nMode ); dc.SetTextColor( crPrevText ); dc.SelectObject( pOldFont ); dc.RestoreDC( iSavedDC ); -------...

Place word document content that is outside of print area
When I place some Word document content into publisher, the content that is outside of the print area is not placed. Perhaps I could fool my computerinto thinking that I have a printer that prints right to the edges. But perhaps there is some setting that says "place whole object not just that part of the object that would be printed" Tim By the way, I will be sending my stuff to a publisher that will be using a "tonbo" in Japanese ( I don't know how to say it in English) which is a spare area of page around my manuscript that is cut off afterwards. Thus he can...

Tool to go through all .cs files and change specific calls
Hi! Is there a tool out there to go through entire code base and change all calls to a specific component to another component ? The code base is somewhat large and it would take me 2 weeks to do it manually. Infinite thanks in advance, --M On 22-03-2010 20:21, Mike wrote: > Hi! Is there a tool out there to go through entire code base and change all > calls to a specific component to another component ? The code base is > somewhat large and it would take me 2 weeks to do it manually. IDE refactor capabilities are not sufficient? Arne > >Hi! Is there a to...

Opening a document
I am trying to open an Excel document and it will only open one row at a time. It has opened fine previously in 2003 and I am trying use 2007. Other documents are opening fine in 2007. Unclear what you mean? Do you just see row 1? Can you not maximize the worksheet window? If you wish, send me the file to look at (delete TRUENORTH. from my address) best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "DEL" <DEL@discussions.microsoft.com> wrote in message news:342EB0A6-1EF8-4A07-9079-3A3CB234488A@microsoft.com... >...