CEdit vs CRichEditCtrl, OEM CharSet. (follow-up)
Benoit Martin -- ehlija@vircom.com
Friday, December 20, 1996
Environment: Win95, VC4.2b
Hi Everyone. This is a kind of follow-up on a previous post I made on this
list. I must say I didn't receive a lot of suggestions/help trying to get
this thing to work. Now, I'm pretty sure it is a bug in the CRichEditCtrl,
but I would need someone to confirm it. Or deny it! ;)
I would really appreciate if you could run this sample code on your machine,
and tell me that this also happens on your machines... The problem comes
from the fact that, the OEM_CHARSET font I use doesn't display OEM_CHARS on
the CRichEditCtrl, but displays them allright in the CEdit one.
Create an OLE Ctrl application using Class Wizard, and add these three
variables in it:
CFont testFont3, CRichEditCtrl txtRich, CEdit txtEdit, then add this sample
code below. This should create one Rich Edit control, and one normal Edit
control, and output the "ascii" characters 190-215 in them, with a
OEM_CHARSET font. If all goes as expected, you should see those characters
display OK in the CEdit text area (the lower one), and you should see in the
Rich Edit Control normal Win ANSI characters instead of the OEMs.. Now, if
after seeing this, anybody as any suggestions, I would be real glad to hear
them..
Thanks again.
Benoit Martin
-----------------code---------------------
CTestCtrl::CTestCtrl()
{
InitializeIIDs(&IID_DTest, &IID_DTestEvents);
SetInitialSize(400,400);
testFont3.CreateFont(0, 0, 0, 0, 400, FALSE, FALSE, 0,
OEM_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH , "MS LineDraw");
}
int CTestCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
CRect Pos;
CString tmp;
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
txtRich = new CRichEditCtrl;
txtEdit = new CEdit;
Pos.SetRect(30, 30, 375, 200);
txtRich->Create( WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL
| ES_MULTILINE | WS_VSCROLL
| ES_AUTOVSCROLL | ES_AUTOHSCROLL,
Pos, this, 100);
Pos.SetRect(30, 220 , 375, 375);
txtEdit->Create( WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL
| ES_MULTILINE | WS_VSCROLL
| ES_AUTOVSCROLL | ES_AUTOHSCROLL,
Pos, this, 101);
txtRich->SetFont(&testFont3);
txtEdit->SetFont(&testFont3);
CString test;
test.Format("%c %c %c %c %c", 190, 195, 200, 205, 210);
txtRich->SetWindowText(test);
txtEdit->SetWindowText(test2);
return 0;
}
--------------------------------------
Mike Blaszczak -- mikeblas@nwlink.com
Sunday, December 22, 1996
At 12:32 12/20/96 -0500, Benoit Martin wrote:
>Environment: Win95, VC4.2b
>Hi Everyone. This is a kind of follow-up on a previous post I made on this
>list. I must say I didn't receive a lot of suggestions/help trying to get
>this thing to work. Now, I'm pretty sure it is a bug in the CRichEditCtrl,
>but I would need someone to confirm it. Or deny it! ;)
Does the behaviour you observe change if you give the rich edit control
a different target device using the EM_SETTARGETDEVICE message?
.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.
| Вернуться в корень Архива
|