Dan Kelly
Dan Kelly

Reputation: 2702

Using Unicode characters with Delphi XE2

I'm looking at converting one of our applications to Delphi XE2 and generally take the opportunity to bring it up to date.

One of the features of the application is a StringGrid that displays a number of check marks in a couple of columns. To achieve this the grid is actually 2 aligned grids - the second of which is setup with the font as Wingdings in order to display the check marks.

Am I wrong in thinking that I should be able to use something like a TListView and use the checkmark char (U+2713) alongside the rest of the text... If so how the heck do I do this?

Do I need to set the font to Wingdings for that column? Does this need to be in OnDraw?

Am I barking up the wrong tree...

Upvotes: 0

Views: 1644

Answers (1)

Ken White
Ken White

Reputation: 125749

File->New->VCL Forms application

In the Component Palette, expand the Win32 tab and choose TListView, and drop it on the form.

Right-click the newly added TreeView1, and choose Items Editor... from the context menu.

Click New Item. Type in any text (for instance x Testing, using the 'x' as a placeholder for now).

Start the Windows Character Map application (Start button, type Chara in the search box, or Start->Programs->Accessories->Character Map). Change the font to Arial Unicode MS, and navigate to the character you want (it's in there).

Click the character, and then the Copy button. Switch back to the IDE, select the x placeholder you put in the edit, and hit Ctrl+V to paste the character you just chose from Character Map. You should now see your check mark (or whatever character you chose), followed by Testing.

(The steps above are the two-minute process I followed to find out how to do this, and that quick experiment showed that you could.)

Upvotes: 5

Related Questions