Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Delphi 2009 Handbook

Project: HighCharTest.dproj

Project Structure

HighCharTest.dpr
program HighCharTest;

uses
  Forms,
  HighCharTest_MainForm in 'HighCharTest_MainForm.pas' {FormHighCharTest};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TFormHighCharTest, FormHighCharTest);
  Application.Run;
end.
HighCharTest_MainForm.pas
unit HighCharTest_MainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFormHighCharTest = class(TForm)
    btnEuro: TButton;
    Memo1: TMemo;
    btnJpn: TButton;
    btnStringLit: TButton;
    procedure btnEuroClick(Sender: TObject);
    procedure btnJpnClick(Sender: TObject);
    procedure btnStringLitClick(Sender: TObject);
  private
    procedure Log (const strMsg: string);
  public
    { Public declarations }
  end;

var
  FormHighCharTest: TFormHighCharTest;

implementation

{$R *.dfm}

procedure TFormHighCharTest.btnEuroClick(Sender: TObject);
var
  str1: string;
begin
  // default behavior
  str1 := #0$80;
 Log (str1 + ' - ' + IntToStr (Ord (str1[1])));

  {$HIGHCHARUNICODE OFF}
  str1 := #0$80;
 Log (str1 + ' - ' + IntToStr (Ord (str1[1])));

  {$HIGHCHARUNICODE ON}
  str1 := #0$80;
 Log (str1 + ' - ' + IntToStr (Ord (str1[1])));

  {$HIGHCHARUNICODE OFF} // regardless
  str1 := #0$0080;
 Log (str1 + ' - ' + IntToStr (Ord (str1[1])));
  {$HIGHCHARUNICODE ON} // regardless
  str1 := #0$0080;
 Log (str1 + ' - ' + IntToStr (Ord (str1[1])));
end;


procedure TFormHighCharTest.btnJpnClick(Sender: TObject);
var
  str1: string;
begin
  str1 := #0$3042#0$3044;
Log (str1 + ' - ' + IntToStr (Ord (str1[1])) + ' - ' + IntToStr (Ord (str1[2])));
end;

procedure TFormHighCharTest.btnStringLitClick(Sender: TObject);
var
  strU: string;
  strA: AnsiString;
begin
  strU := 'one€';
  strA := 'one€';

  Log (strU + ' - ' + IntToStr (Ord (strU[4])));
  Log (strA + ' - ' + IntToStr (Ord (strA[4])));
end;

procedure TFormHighCharTest.Log(const strMsg: string);
begin
  Memo1.Lines.Add (strMsg);
end;

end.
HighCharTest_MainForm.pas.dfm
object FormHighCharTest: TFormHighCharTest
  Left = 0
  Top = 0
  Caption = 'HighCharTest'
  ClientHeight = 292
  ClientWidth = 554
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object btnEuro: TButton
    Left = 8
    Top = 8
    Width = 113
    Height = 25
    Caption = 'btnEuro'
    TabOrder = 0
    OnClick = btnEuroClick
  end
  object Memo1: TMemo
    Left = 136
    Top = 8
    Width = 410
    Height = 276
    TabOrder = 1
  end
  object btnJpn: TButton
    Left = 8
    Top = 40
    Width = 113
    Height = 25
    Caption = 'btnJpn'
    TabOrder = 2
    OnClick = btnJpnClick
  end
  object btnStringLit: TButton
    Left = 16
    Top = 184
    Width = 105
    Height = 25
    Caption = 'btnStringLit'
    TabOrder = 3
    OnClick = btnStringLitClick
  end
end
HTML file generated by PasToWeb, a tool by Marco Cantù
Copyright 2008 Marco Cantù