Results 1 to 7 of 7

Thread: Display Unicode Chess Symbols in Text Boxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2019
    Posts
    21

    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.

  2. #2
    Fanatic Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,012

    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).

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2019
    Posts
    21

    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?

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,159

    Re: Display Unicode Chess Symbols in Text Boxes

    Quote Originally Posted by victor_knight View Post
    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2019
    Posts
    21

    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?

  6. #6
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,159

    Re: Display Unicode Chess Symbols in Text Boxes

    Quote Originally Posted by victor_knight View Post
    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

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Oct 2019
    Posts
    21

    Re: Display Unicode Chess Symbols in Text Boxes

    Fantastic. That works. Thank you.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width