How to change charset of ANSI ComboBox

The place for threads about TimoSoft ComboListBoxControls
Post Reply
doublespin
Cadet
Posts: 5
Joined: 04 Aug 2010, 16:16

How to change charset of ANSI ComboBox

Post by doublespin »

Hi

I' m trying to use an ANSI ComboBox control to choose and display greec, romanian and turkish text. I want to set the language codepage by changing the font.charset property (for example 161 for greec). But the items of combobox doesn't display correctly. For all other controls I tried this works fine - not for comboboxes.
If I choose one faulty entry of the comboboxes list by clicking it, the choosen text will be assignd to comboboxes.Text property and it shows correctly. Notice: Only the list content doesn't work.
By the way: The combobox controls from MS (standard and forms2) does display the list items incorrect too.
Any ideas?

Thx
Doublespin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: How to change charset of ANSI ComboBox

Post by TiKu »

Why don't you use the Unicode ComboBox? It does not need this charset rubbish. ANSI is dead.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
doublespin
Cadet
Posts: 5
Joined: 04 Aug 2010, 16:16

Re: How to change charset of ANSI ComboBox

Post by doublespin »

Because my App is an "old" one and it contains a lot of controls that doesn't support Unicode but working with charset property. And unfortunately there is no suitable alternative to replace the controls.
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: How to change charset of ANSI ComboBox

Post by TiKu »

Okay, users could enter Unicode characters into the Unicode controls and your app could not handle these characters. This is the only problem I can see.

If you provide a small sample app that exhibits the problem, I'll do some tests tonight. Maybe the combo box simply does not update the drop-down list's font automatically. This could be worked around.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
doublespin
Cadet
Posts: 5
Joined: 04 Aug 2010, 16:16

Re: How to change charset of ANSI ComboBox

Post by doublespin »

Hi TiKu

Thank you for your time.

To write Greek characters: In Control Panel, Regional and Language Options, Languages, Details add Greek Keyboard Layout
Choose the "EL Greek" keyboard and test it in Notepad. Type keys a, b, g on german or us keyboard will display the Greek chars Alpha, Beta, Gamma (αβγ)

Here ist my sampe.
On a form place one ANSI combobox and one textbox.
In Form_Load event paste the following:

Code: Select all

Private Sub Form_Load()
    Const GREEK_CHARSET = 161
    
    ComboBox1.Style = sComboDropDownList
    ComboBox1.UseSystemFont = False
    ComboBox1.Font.Charset = GREEK_CHARSET
    ComboBox1.ComboItems.RemoveAll
    'Add the Greek chars Alpha, Beta, Gamma (Keys a, b, g on german keyboard)
    ComboBox1.ComboItems.Add "áâã"
    'Add the Greek chars Delta, Epsilon, Zeta (Keys d, e, y on german keyboard)
    ComboBox1.ComboItems.Add "äåæ"
    'Assign the chars Alpha, Beta, Gamma (Keys a, b, g on german keyboard)
    ComboBox1.Text = "áâã"
    
    '--> The text on combo will be OK
    '--> The items list will not
        
    'For control fill textbox
    Text1.Font.Charset = GREEK_CHARSET
    Text1.Text = "áâã"
    '--> No Problem to display correct chars
End Sub
Thx
Doublespin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: How to change charset of ANSI ComboBox

Post by TiKu »

Interesting: If I specify a manifest, so that Visual Styles are used, neither the text box nor the combo box display the characters correctly.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: How to change charset of ANSI ComboBox

Post by TiKu »

This seems to be an issue with Windows' native list box control. I don't know how to work around this bug.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply