How to make character map

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

Comments

  • : 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.
    [code]
    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;
    [/code]
  • : : 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.
    : [code]
    : 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;
    : [/code]
    :
    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 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.
    : : [code]
    : : 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;
    : : [/code]
    : :
    : 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.
  • Did you have any luck getting to make the delphi unicode character map project ?

    Please let me know...

    Richard
  • 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
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories