Combobox issue with & Character

We ran into an odd one this morning.

Location names were not showing up correctly in a combo box control.

Freezer R&D was showing up as Freezer RD

It appears that the combo box control has some logic to create hot keys for the choices using the & character, just like there is for captions. The only problem is, we don’t want that!

I haven’t found a option or setting to turn it off. The only way to avoid it that I can see is to make sure that any & character is doubled up as && when displayed in a combo box control.

If you would like to see this behavior for yourself it is really easy to duplicate. Create a combo box control that is filled by programming and put the following in the initial contents.

2014-11-21_1026

And when you run the window you will see the combo contains.

2014-11-21_1027

Notice the “Single R&D” is displaying as “Single RD

I have reported this to support, and will post here when I get a response.

===================================
Update 11/30/2014

I did receive a response from pcSoft, but it was basically just confirming that it is the intended behavior and has always been there.

Fortunately Derek Theobald, from the Google+ group offered a better solution!

In the initialization code of your combo box, include the line

MySelf..InterpretAmpersand = False

This tells WX to ignore the & and not try to turn it into a shortcut.

Thanks again, Derek!

===================================

Now, back to your regular schedule program….

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s