Display Unicode Chess Symbols in Text Boxes
Hi,
I've been searching online but haven't been able to find a way to display Unicode characters in VB6 text boxes (including the rich text box). In particular, I would like to be able to display the chess symbols shown here:
https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode
I know VB6 can indeed support Unicode characters but I'm not sure these particular ones are supported or what else I need to import or include (and how) in order to get them to work. Any help is much appreciated. Thanks.
Re: Display Unicode Chess Symbols in Text Boxes
Arial Unicode MS has these ♙♘♗♖♕♔ ♟♞♝♜♛♚
I copy these from my chess program written in M2000 (a language which is written in VB6).
You have to use Krool's unicode controls, if you prefer textboxes. But you can draw on a form in any size these, using DrawText function (from OS).
Re: Display Unicode Chess Symbols in Text Boxes
I'm still not clear how, exactly, to get this to work. What references/modules/components do I need to import (without messing up anything else I have imported)? Is there a line or two of code demonstrating how these symbols can actually be sent to a text box after that?
Re: Display Unicode Chess Symbols in Text Boxes
Quote:
Originally Posted by
victor_knight
I'm still not clear how, exactly, to get this to work.
If you want something pre-installed on the system for a fast test...:
- include the MS InkEdit component into your Project...
- set this Controls Font(Name) to "Segoe UI Symbol"
- and then use the ChrW-function to assign Values to its Text-Property
e.g.
Inkedit1.Text = ChrW(9822) '<- should give you a black knight in the Ctl
HTH
Olaf
Re: Display Unicode Chess Symbols in Text Boxes
Okay, that seems to work. However, when I try to copy such symbols from the Inkedit box like this:
Clipboard.SetText (InkEdit1.Text)
And then paste it into Notepad (Windows 10), all I get is a question mark (?) symbol. By the way, Notepad does support these symbols as I can directly copy and paste them from the Wikipedia page linked above. Why can't I extract them from the Inkedit text box in the same or similar way?
Re: Display Unicode Chess Symbols in Text Boxes
Quote:
Originally Posted by
victor_knight
Clipboard.SetText (InkEdit1.Text)
Why can't I extract them from the Inkedit text box ...
Because introducing Unicode-capable controls into your App is one step -
an Unicode-capable ClipBoard-Class would be the next one (VBs runtime-integrated Clipboard-Class only supports ANSI).
Not sure whether Krool has an UniClipboard-Class alreaedy integrated in his OCX -
but there should be several of them "flying around" when you google.
In case you already use the vbRichClient5 (or 6) libary, this comes with such an enhanced Clipboard-Class...
( usage there via e.g: New_c.ClipBoard.SetText Inkedit1.Text )
HTH
Olaf
Re: Display Unicode Chess Symbols in Text Boxes
Fantastic. That works. Thank you.