* Update minimal demo to use utf8

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@667 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2009-01-21 00:51:12 +00:00
parent 2b47043b52
commit 0c03cacf37
3 changed files with 11 additions and 11 deletions

View File

@ -3,8 +3,6 @@ object MainForm: TMainForm
Height = 486 Height = 486
Top = 147 Top = 147
Width = 427 Width = 427
HorzScrollBar.Page = 426
VertScrollBar.Page = 485
ActiveControl = VST ActiveControl = VST
Caption = 'Simple Virtual Treeview demo' Caption = 'Simple Virtual Treeview demo'
ClientHeight = 486 ClientHeight = 486
@ -12,11 +10,12 @@ object MainForm: TMainForm
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.27'
object Label1: TLabel object Label1: TLabel
Left = 10 Left = 10
Height = 17 Height = 14
Top = 8 Top = 8
Width = 171 Width = 112
Caption = 'Last operation duration:' Caption = 'Last operation duration:'
ParentColor = False ParentColor = False
end end
@ -28,7 +27,9 @@ object MainForm: TMainForm
BorderStyle = bsSingle BorderStyle = bsSingle
Colors.BorderColor = clWindowText Colors.BorderColor = clWindowText
Colors.HotColor = clBlack Colors.HotColor = clBlack
DefaultText = 'Node'
Header.AutoSizeIndex = -1 Header.AutoSizeIndex = -1
Header.Columns = <>
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif' Header.Font.Name = 'MS Sans Serif'
Header.MainColumn = -1 Header.MainColumn = -1
@ -45,7 +46,6 @@ object MainForm: TMainForm
OnFreeNode = VSTFreeNode OnFreeNode = VSTFreeNode
OnGetText = VSTGetText OnGetText = VSTGetText
OnInitNode = VSTInitNode OnInitNode = VSTInitNode
Columns = <>
end end
object ClearButton: TButton object ClearButton: TButton
Left = 97 Left = 97

View File

@ -28,7 +28,7 @@ type
procedure ClearButtonClick(Sender: TObject); procedure ClearButtonClick(Sender: TObject);
procedure AddButtonClick(Sender: TObject); procedure AddButtonClick(Sender: TObject);
procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var Text: WideString); var Text: UTF8String);
procedure VSTFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode); procedure VSTFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure VSTInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode; procedure VSTInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates); var InitialStates: TVirtualNodeInitStates);
@ -50,7 +50,7 @@ type
// Extend it to whatever your application needs. // Extend it to whatever your application needs.
PMyRec = ^TMyRec; PMyRec = ^TMyRec;
TMyRec = record TMyRec = record
Caption: WideString; Caption: UTF8String;
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -126,14 +126,14 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; procedure TMainForm.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var Text: WideString); var Text: UTF8String);
var var
Data: PMyRec; Data: PMyRec;
begin begin
// A handler for the OnGetText event is always needed as it provides the tree with the string data to display. // A handler for the OnGetText event is always needed as it provides the tree with the string data to display.
// Note that we are always using WideString. // Note that we are always using UTF8String.
Data := Sender.GetNodeData(Node); Data := Sender.GetNodeData(Node);
if Assigned(Data) then if Assigned(Data) then
Text := Data.Caption; Text := Data.Caption;

View File

@ -2,10 +2,11 @@
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="6"/> <Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/> <AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
@ -46,7 +47,6 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<ResourceFilename Value="Main.lrs"/>
<UnitName Value="Main"/> <UnitName Value="Main"/>
</Unit1> </Unit1>
</Units> </Units>