Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 944
  • Last Modified:

Setting rect on CRichEditCtrl.

I have a rich edit view.  The text runs all the way to the edges and I can't figure out how to set it in - give the control margins on the screen.  I use this...

CRect rect;
GetRichEditCtrl().GetRect(&rect);
rect.DeflateRect(15, 0);
GetRichEditCtrl().SetRect(&rect);

...in OnCreate in my Rich Edit View class and it works fine in XP.  But it doesn't in Win98.  I sat here for two hours trying every combination of getrect, getclientrect, setrect, invalidate, GetRichEditCtrl.Invalidate -- everything I can think of and I can't get the text to budge off the sides of the control.  The left side doesn't look too bad, but on the right side the text goes right up against the edge.  

Can someone please help me set the margins on a rich edit view?  Thanks.
0
jjjkkklll
Asked:
jjjkkklll
  • 3
  • 3
1 Solution
 
AlexFMCommented:
Instead of rich edit view use CFormView with rich edit control and set rich edit rectangle in WM_SIZE message handler.
0
 
jjjkkklllAuthor Commented:
Hi AlexFM,

That would probably work, but I'm very dug in on this one - it's too late to change it all at this point.  Is there no way to change the typing area on an existing rich edit view?
0
 
ParticlenessCommented:
The rich edit works on XP but not Windows 98...I had a problem when that happened and just replaced the rich edit control dll file on win98 with the xp one. If you're selling your product, though, I don't know how you can legally distribute the dll file.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ParticlenessCommented:
I just researched the redistribution of rich edit controls and it happens you're out of luck: http://www.codeguru.com/mfc/comments/12047.shtml Sorry.
0
 
ParticlenessCommented:
From that link you an get to a workaround with a microsoft installer, but then you bog down the user in installing MSI with your software.
0
 
jjjkkklllAuthor Commented:
Thanks Particleness for your info.  I finally used AlexFM's suggestion out of frustration.  What I did was to change my RichEditView to a FormView.  I created a new program with FormView as the view's base class and then took it file by file to change the view over.  Then I solved a pile of compiler errors one at a time.  Then I added the rich edit control and everything seems to work fine.  It actually didn't take as long as I thought it would (about 2 hours).  I'm sure there's a lot of extra code bits in there that I don't need anymore, but it's working so I'm not touching it.  Thanks for your help.
0
 
jjjkkklllAuthor Commented:
Just to clarify (after reading my last post) I compared my existing program to the new FormView program and I changed my existing program to have a formview - I didn't start from scratch, I converted my existing RichEditView to a FormView.  Just wanted to make that clear.  Thanks again.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now