A strange BUG about Richview using unicode~~~~
Posted: Thu May 20, 2010 8:49 am
I think I found a BUG about TRichview.
I'm using Delphi 6.0.
Create a new project, place a TRichView and a TRVStyle onto the Form1, and set it support unicode as the help says. Then I add some unicode text to it, some text works fine, but some words do not work , It looks like the Richview "eats" some word...
eg: I add the word "Ñ¡Ôñ" to richview, it only shows "Ôñ".
But, If I insert some other western letter before it, like "okÑ¡Ôñ", then it will be shown totally.
Here is my unit1.pas:
And here is my unit1.dfm:
I'm using Delphi 6.0.
Create a new project, place a TRichView and a TRVStyle onto the Form1, and set it support unicode as the help says. Then I add some unicode text to it, some text works fine, but some words do not work , It looks like the Richview "eats" some word...
eg: I add the word "Ñ¡Ôñ" to richview, it only shows "Ôñ".
But, If I insert some other western letter before it, like "okÑ¡Ôñ", then it will be shown totally.
Here is my unit1.pas:
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, RVStyle, RVScroll, RichView;
type
TForm1 = class(TForm)
RichView1: TRichView;
RVStyle1: TRVStyle;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Richview1.AddNLWTag(edit1.text,0,0,0);
Richview1.Format;
end;
end.
Code: Select all
object Form1: TForm1
Left = 307
Top = 133
Width = 348
Height = 155
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object RichView1: TRichView
Left = 8
Top = 8
Width = 313
Height = 81
TabOrder = 0
DoInPaletteMode = rvpaCreateCopies
RTFReadProperties.UnicodeMode = rvruOnlyUnicode
RTFReadProperties.TextStyleMode = rvrsAddIfNeeded
RTFReadProperties.ParaStyleMode = rvrsAddIfNeeded
RTFReadProperties.UseCharsetForUnicode = True
RTFReadProperties.CharsetForUnicode = GB2312_CHARSET
RVFOptions = [rvfoSavePicturesBody, rvfoSaveControlsBody, rvfoSaveBinary, rvfoSaveTextStyles, rvfoSaveParaStyles, rvfoSaveDocProperties, rvfoLoadDocProperties]
Style = RVStyle1
end
object Button1: TButton
Left = 8
Top = 96
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object Edit1: TEdit
Left = 88
Top = 96
Width = 121
Height = 21
TabOrder = 2
Text = 'Ñ¡Ôñ'
end
object RVStyle1: TRVStyle
TextStyles = <
item
StyleName = 'Normal text'
Charset = GB2312_CHARSET
FontName = 'Arial'
Unicode = True
end>
ParaStyles = <
item
StyleName = 'Paragraph Style'
Tabs = <>
end>
ListStyles = <>
StyleTemplates = <>
Left = 104
Top = 96
end
end