Advanced Delphi

Moderators: None (Apply to moderate this forum)
Number of threads: 331
Number of posts: 741

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to make character map Posted by Grifitz on 27 Mar 2003 at 6:40 AM
I want to make a character map program using delphi 6 or 7, but I can't find the component display the letter especially the unicode letter from a installed system font like Arial or Webdings
Report
Re: How to make character map Posted by zibadian on 27 Mar 2003 at 12:31 PM
: I want to make a character map program using delphi 6 or 7, but I can't find the component display the letter especially the unicode letter from a installed system font like Arial or Webdings
:
That's quite easy to do. For this you need a form with a button, a stringgrid and a label. The code below will fill the stringgrid with the characters #0 to #CellCount. So a 16 by 16 grid shows all first 256 characters. With the OnSelectCell() event you can get the character code into the label as shown below.
procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  with StringGrid1 do
    for i := 0 to RowCount*ColCount-1 do // loop through maximum number of cells
      Cells[i mod ColCount, i div ColCount] := WideChar(i); 
        // Get the character based on its index
end;

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  Label1.Caption := IntToStr(ARow*StringGrid1.ColCount+ACol);
end;

Report
Re: How to make character map Posted by Grifitz on 30 Mar 2003 at 11:49 PM
: : I want to make a character map program using delphi 6 or 7, but I can't find the component display the letter especially the unicode letter from a installed system font like Arial or Webdings
: :
: That's quite easy to do. For this you need a form with a button, a stringgrid and a label. The code below will fill the stringgrid with the characters #0 to #CellCount. So a 16 by 16 grid shows all first 256 characters. With the OnSelectCell() event you can get the character code into the label as shown below.
:
: procedure TForm1.Button1Click(Sender: TObject);
: var
:   i: integer;
: begin
:   with StringGrid1 do
:     for i := 0 to RowCount*ColCount-1 do // loop through maximum number of cells
:       Cells[i mod ColCount, i div ColCount] := WideChar(i); 
:         // Get the character based on its index
: end;
: 
: procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
:   ARow: Integer; var CanSelect: Boolean);
: begin
:   Label1.Caption := IntToStr(ARow*StringGrid1.ColCount+ACol);
: end;
: 

:
Well, the code is good, but how I know the number of character a font can take, cause there are font that can have more than 5000 character since unicode character take 32 bit(65525).
Report
Re: How to make character map Posted by zibadian on 31 Mar 2003 at 9:23 AM
: : : I want to make a character map program using delphi 6 or 7, but I can't find the component display the letter especially the unicode letter from a installed system font like Arial or Webdings
: : :
: : That's quite easy to do. For this you need a form with a button, a stringgrid and a label. The code below will fill the stringgrid with the characters #0 to #CellCount. So a 16 by 16 grid shows all first 256 characters. With the OnSelectCell() event you can get the character code into the label as shown below.
: :
: : procedure TForm1.Button1Click(Sender: TObject);
: : var
: :   i: integer;
: : begin
: :   with StringGrid1 do
: :     for i := 0 to RowCount*ColCount-1 do // loop through maximum number of cells
: :       Cells[i mod ColCount, i div ColCount] := WideChar(i); 
: :         // Get the character based on its index
: : end;
: : 
: : procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
: :   ARow: Integer; var CanSelect: Boolean);
: : begin
: :   Label1.Caption := IntToStr(ARow*StringGrid1.ColCount+ACol);
: : end;
: : 

: :
: Well, the code is good, but how I know the number of character a font can take, cause there are font that can have more than 5000 character since unicode character take 32 bit(65525).
:
I couldn't find any function or property which returns the number of characters in a font. I suggest that you let the user decide how many characters are shown.
Report
Re: How to make character map Posted by nostradamus777 on 17 Mar 2010 at 8:21 PM
Did you have any luck getting to make the delphi unicode character map project ?

Please let me know...

Richard
Report
Re: How to make character map Posted by Philips10 on 22 Feb 2011 at 12:50 PM
Hi

I want to use that code of your with a T(JV)RichEdit,
where under the T(JV)RichEdit the stringgrid with
the UTF-8 / UNICODE-Chars appear. By setting the
TFontCharset, I can fillup the StringGrrid with
Arabic, Hebrew, Russian, Turkish and Western...

The Russian omage eg has the ASCII-Code 916

But filling up the StringGrid with Russian chars
(Unicode Arial), omega has the value 191.

How can I caculate between 916 of the UNICODE-code
and the 191-ASCII-Code inside the Stringgrid
(to and through:
-- the user selects Omage inside the T(JV)RichEdit
and anside the StringGrid, the Char Omage will be highlighted
-- The user clicks inside of the Stringgrid (with Charset Russian)
on Omega and inside the RichEdit (and eg also inside the
UNICODE-conntrol TNTEdit), Omage wil be set.

How can I achieve this (maybe with a formula, but calculations
by dividing by 256 won't work).

A big thank you in advance



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.