Delphi Unicode Forms TRectangle TText

I am new to Delphi and the DelphiXE4 editor. I am trying to make a chess guide in shape using the x64 TRectangle for the board (alternative colors). I want to add unicode chess pieces, but in the ObjectInspector properties, when I add unicode, it is displayed literally in the form. How to add Unicode to TText (so that the form displays unicode as chess pieces)? (After I want to add dragndrop to TRectangles / unicode chess - any ideas?).

Rectangle63: TRectangle; Rectangle64: TRectangle; Text1: TText; Text2: TText; 

Here is a screenshot showing the problem: DelphiXe4 FMX TRectangle TText Unicode char not displaying

I am very grateful for the help, thanks

EDIT: Jeroen's answer worked to solve this for me (which I did by copying / pasting the Unicode checkerboard image into the TText text property). I will show a screenshot of exe. Then I want to add DRAGNDROP to these parts .....

DelphiXe4 FMX Trectangle TText Unicode Chessboard correct

EDIT2: (Jeroen font size bug fixed) Unicode black king display fixed - see screenshot: Fixed unicode black king display

+4
source share
1 answer

Unicode Chess Pieces can be shown in any Delphi app if you have a love containing Glyphs for various Unicode CodePoints representing Chess Pieces .

Actually, it doesn't matter which platform or development environment you use as long as they support Unicode, and you have the correct font.

You need:

  • a means enter these unicode codes
  • a font representing these Unicode codes as characters on the target platform

To start with the latter, for Microsoft Windows these fonts work fine:

There are two approaches to Microsoft Windows for entering this data:

To copy / paste, I often go to a web page with the correct characters using a web browser that supports Unicode, or search for them using the Character app .

To simplify copying / pasting:

  • These are the white parts: β™”β™•β™–β™—β™˜β™™
  • These are the black parts: β™šβ™›β™œβ™β™žβ™Ÿ

An example of a FireMonkey form with all parts in 1 TText in one TTRectangle :

 object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 480 ClientWidth = 640 FormFactor.Width = 320 FormFactor.Height = 480 FormFactor.Devices = [dkDesktop, dkiPhone, dkiPad] DesignerMobile = False DesignerWidth = 0 DesignerHeight = 0 DesignerDeviceName = '' DesignerOrientation = 0 object Rectangle1: TRectangle Height = 50.000000000000000000 Width = 80.000000000000000000 object Text1: TText Color = claBlack Height = 50.000000000000000000 Text = #9812#9813#9814#9815#9816#9817#9818#9819#9820#9821#9822#9823 Width = 80.000000000000000000 end end end 

Edit

I think you have a problem with the font size in your form file. Create a new question with the text of your form file. Two ways to do this:

  • open Notepad, and in Notepad open the .FMX file that comes with your form; copy text to clipboard
  • In Delphi, right-click on the form, then select "View as Text", select all the text and copy it to the clipboard, right-click on the text of the form and select "View as Form".

Paste the code http://pastebin.com/ or https://gist.github.com/ then post this link in a new question. After this comment you made, and I will take a look.

+3
source

Source: https://habr.com/ru/post/1487014/


All Articles