From: "Marco Cimarosti" <[EMAIL PROTECTED]>

> In case 1, you just have a font problem: the Cyrillic characters are there
> but the font you use doesn't have glyphs for them. Although I don't expect
> that this is the problem, you could fix it by setting each control's font
> face to a proper font. E.g.:
>
> cmdMyButton.Caption = "Чао а тутто ил мондо!"
> cmdMyButton.Font.Name = "MyCyrillicFont"

Well, this will be work if you are on compiling a Cyrillic system --
otherwise you cannot have Cyrillic strings in the code.

> In case 2 (which is what I would expect), you have a conversion problem.
> Unfortunately, VB controls up to 6.x do not support Unicode. Unicode is
> supported internally (you can have Unicode strings), and it is supported
the
> conversion from Unicode to Windows' character set and vice versa, but the
> controls themselves must be in one Windows character set. In this case,
you
> have to change each control's encoding *before* you set its text/caption
> with Cyrillic text:
>
> Const charsetCyrillic As Integer = 204
> cmdMyButton.Font.Charset = charsetCyrillic
> cmdMyButton.Font.Name = ""
> cmdMyButton.Caption = "Чао а тутто ил мондо!"

>
> Setting the font name to an empty strings causes the Font object to choose
> the default font for the control's code page. Of course, you can also
> explicitly set a font name that you know supports that code page.

You do not have to set the name; changing the charset will cause COM to enum
for a font that supports it.

> I found value 204 by experimentation; unfortunately, I don't know where to
> find a complete list of supported character sets,

There is one in my book (http://www.i18nwithvb.com/) ? <g>

> If it was my task, I'd prefer to have centralized code which loops through
> all the forms and controls in the application to set their charset.

Ah, there is also an add-in that helps you do this for localization
purposes....

> Note that this approach implies that all forms are loaded (although not
> necessarily shown) at start up, because the object <Forms> only contains
> loaded forms. The form's menu should be just one more control, thus it
> should be handled by the loop as well.

The add-in assumes you will add an init call to each form's load event.

> Hopefully, one version of VB will arrive one day whose controls are fully
> enabled to Unicode and smart fonts. So, all this code could be put inside
> <#If>'s so that it can be disabled when porting to newer Visual Basic.

That is mostly true on VB.Net (the only caveat is that on Win9x some
controls are still not Unicode as they use standard EDIT controls for
textboxes, etc. They use the Unicode ones on WinNT/2K/XP though. :-)


MichKa

Michael Kaplan
Trigeminal Software, Inc.  -- http://www.trigeminal.com/


Reply via email to