* Use UTF8 as the unicode encoding

* Update the unicode demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@645 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2008-12-23 17:54:03 +00:00
parent 6b4a9600fe
commit 136f56b7e5
4 changed files with 156 additions and 269 deletions

View File

@ -26,20 +26,21 @@ object MainForm: TMainForm
Align = alClient
BorderSpacing.Around = 3
BorderStyle = bsSingle
DefaultText = 'Node'
Header.Columns = <
item
Text = 'Language'
Width = 200
end
item
Position = 1
Text = 'Translation'
Width = 200
end>
Header.Options = [hoColumnResize, hoDrag, hoVisible]
TabOrder = 0
OnFreeNode = WelcomeTreeFreeNode
OnGetText = WelcomeTreeGetText
Columns = <
item
Width = 200
WideText = 'Language'
end
item
Position = 1
Width = 200
WideText = 'Translation'
end>
end
object WelcomeTopPanel: TPanel
Height = 28
@ -73,6 +74,8 @@ object MainForm: TMainForm
Width = 272
BorderSpacing.Around = 3
BorderStyle = bsSingle
DefaultText = 'Node'
Header.Columns = <>
Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag]
TabOrder = 0
@ -80,7 +83,6 @@ object MainForm: TMainForm
OnFreeNode = LCLTextTreeFreeNode
OnGetText = LCLTextTreeGetText
OnNewText = LCLTextTreeNewText
Columns = <>
end
object AddEditTextButton: TButton
Left = 476

View File

@ -39,12 +39,12 @@ type
procedure FormCreate(Sender: TObject);
procedure LCLTextTreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure LCLTextTreeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
Column: TColumnIndex; TextType: TVSTTextType; var CellText: UTF8String);
procedure LCLTextTreeNewText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; const NewText: WideString);
Column: TColumnIndex; const NewText: UTF8String);
procedure WelcomeTreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure WelcomeTreeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
Column: TColumnIndex; TextType: TVSTTextType; var CellText: UTF8String);
private
procedure AddLCLText(const AText: String);
{ private declarations }
@ -106,16 +106,16 @@ end;
procedure TMainForm.LCLTextTreeGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
var CellText: UTF8String);
var
Data: PLCLTextData;
begin
Data := Sender.GetNodeData(Node);
CellText := UTF8Decode(Data^.Text);
CellText := Data^.Text;
end;
procedure TMainForm.LCLTextTreeNewText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; const NewText: WideString);
Node: PVirtualNode; Column: TColumnIndex; const NewText: UTF8String);
var
Data: PLCLTextData;
begin
@ -170,14 +170,14 @@ end;
procedure TMainForm.WelcomeTreeGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
var CellText: UTF8String);
var
Data: PWelcomeData;
begin
Data := Sender.GetNodeData(Node);
case Column of
0: CellText := UTF8Decode(Data^.Language);
1: CellText := UTF8Decode(Data^.Translation);
0: CellText := Data^.Language;
1: CellText := Data^.Translation;
end;
end;

View File

@ -2,10 +2,11 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
@ -48,7 +49,6 @@
<ComponentName Value="MainForm"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="fmain.lrs"/>
<UnitName Value="fMain"/>
</Unit1>
</Units>