Subject | Re: [IBO] unable to fix charset and font for TIB_ComboBox |
---|---|
Author | Helen Borrie |
Post date | 2004-08-19T03:41:28Z |
At 02:17 AM 19/08/2004 +0000, you wrote:
First, the Charset property of the connection object has to be the same as
the default character set of the database. And this Charset applies only
to data that are stored as, or extracted as, strings (VARCHAR or CHAR). So
Delphi converts the Fb/IB number types and displays them as Arabic numbers.
But this Charset property is not the one concerned in your problem.
The other Charset property is that of the Font attribute of the
control. It is unrelated to the database Charset (although, of course, it
is important that this Charset enables codepage-correct strings to be
written to the database). It needs to be one of the font constants defined
in Delphi's TFontCharset type, or a user-defined constant supplied by the
vendor of your font - and, of course, this font must be the same as the one
that is currently used on the client machine. You can inspect the "known"
charset constants in the Delphi help for TFontCharset.
It gets more complicated (perhaps impossibly so) in data-bound
controls. Although number types are displayed by way of a number-to-string
conversion, numerals won't be converted to anything but a string of one or
more alphanumeric characters, in the range 0-9, and the locale-specific
separators. The behaviour is enscapsulated in the 'AsSomeType' methods and
makes a lot of use of variants.
Some character sets (not talking about database charsets here, but fonts)
"know" about the mapping of arabic alphanumerics to font-specific symbols,
others don't. I don't know of any routine available in English-language
editions of Delphi that supports it. If you are using a Chinese-language
version of Delphi, you might find some kind of language-specific extended
support among the various Format routines, that already provides the
capability to intercept OnGetText and/or OnSetText, and display
alphanumerics using the locale symbols.
If not, you might be able to achieve what you want, somehow, by writing
your own mapping routine, or by Googling for a component or routine that
someone else has already done.
fwiw, as a guess, I would have tried exactly the strategy that you tried
with the TIB_ComboBox. But did you realise that ItemValues is ignored if
the TIB_ComboBox.Style property is csDropDown?
Helen
>Dear all,This is a fraught issue, Michael! There are several issues here...
>
>I have a TIB_ComboBox with its DataField set to a integer field of a
>TIB_Query. I set its font and charset to chinese in the IDE. At run
>time I load its Items with chinese text ItemValues with integers. but
>the chinese text cannot be display correctly.
>
>It seems the font settings in the IDE is overrided during run time. I
>tried to set the font settings to chinese at run time but still
>doesn't help.
>
>Any suggestion please? I ma using IBO4.3Aa
First, the Charset property of the connection object has to be the same as
the default character set of the database. And this Charset applies only
to data that are stored as, or extracted as, strings (VARCHAR or CHAR). So
Delphi converts the Fb/IB number types and displays them as Arabic numbers.
But this Charset property is not the one concerned in your problem.
The other Charset property is that of the Font attribute of the
control. It is unrelated to the database Charset (although, of course, it
is important that this Charset enables codepage-correct strings to be
written to the database). It needs to be one of the font constants defined
in Delphi's TFontCharset type, or a user-defined constant supplied by the
vendor of your font - and, of course, this font must be the same as the one
that is currently used on the client machine. You can inspect the "known"
charset constants in the Delphi help for TFontCharset.
It gets more complicated (perhaps impossibly so) in data-bound
controls. Although number types are displayed by way of a number-to-string
conversion, numerals won't be converted to anything but a string of one or
more alphanumeric characters, in the range 0-9, and the locale-specific
separators. The behaviour is enscapsulated in the 'AsSomeType' methods and
makes a lot of use of variants.
Some character sets (not talking about database charsets here, but fonts)
"know" about the mapping of arabic alphanumerics to font-specific symbols,
others don't. I don't know of any routine available in English-language
editions of Delphi that supports it. If you are using a Chinese-language
version of Delphi, you might find some kind of language-specific extended
support among the various Format routines, that already provides the
capability to intercept OnGetText and/or OnSetText, and display
alphanumerics using the locale symbols.
If not, you might be able to achieve what you want, somehow, by writing
your own mapping routine, or by Googling for a component or routine that
someone else has already done.
fwiw, as a guess, I would have tried exactly the strategy that you tried
with the TIB_ComboBox. But did you realise that ItemValues is ignored if
the TIB_ComboBox.Style property is csDropDown?
Helen