[wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
pngbill
In need of some credit
In need of some credit
Posts: 5
Joined: Thu May 24, 2018 4:10 pm

[wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by pngbill »

We are using a customized translation chooser control derived from wxOwnerDrawnComboBox in our open source application (called Adapt It - see adaptit.org) that helps a bilingual person translate between two languages or dialects. The translation chooser is created on the heap with its parent being the application's canvas which is derived from wxScrolledWindow. The implementation for the Windows and Linux versions looks like the attached screen shots. The translation chooser moves along the target language line in interlinear fashion when Enter or Tab is pressed, and shows at a given location any previously entered translations in its popup list.
Windows version of Translation Chooser
Windows version of Translation Chooser
Windows-trans-chooser.png (38.84 KiB) Viewed 1452 times
Linux version of Translation Chooser
Linux version of Translation Chooser
Linux-trans-chooser.png (66.12 KiB) Viewed 1452 times
The problem:
The application as a whole is mature and works fine. However, the character handling behavior of our wxOwnerDrawnComboBox derived Translation Chooser control is blocked in the Linux version from entering text within the Translation Chooser control's edit box - when the popup control is open (as seen in the screen shots). The user should be able to either choose a previous translation from the popup list, or simply start typing a new translation into the control's edit box while the popup is open. Those capabilities work well in the Windows version. On Windows, the first alphanumeric key press made while the popup list is open automatically closes the popup and the character is entered into the edit box. In the Linux version, however, one cannot type any alphanumeric characters at all without first doing an action (like clicking on the down button or pressing the Esc key) to deliberately close the popup list, after which alphanumeric characters can then be entered into the edit box. In both applications the focus is set to the Translation Chooser control, but the Linux version won't accept alphanumeric key strokes into the edit box while the popup is open. We would like the Linux version to handle alphanumeric characters the same as the Windows version does. But the differing behaviors are a source of concern that cause extra work and frustration on the part of the user of the Linux version.
The wxWidgets combo sample exhibits the same problem:
The wxWidgets combo sample also exhibits these same differing behaviors between the Windows and Linux version of the combo sample. The Linux sample for an editable wxOwnerDrawnComboBox refuses alphanumeric key strokes while the popup is open, but the Windows sample accepts alphanumeric key strokes immediately (and automatically closes the popup in the process).
Steps to see the problem:
1. Build and run the combo sample on Linux and Windows.
2. Select the "Compare against wxComboBox" item from File menu.
3. In the wxOwnerDrawnComboBox for "Writeable, with margins, sorted" at upper left, open the popup list.
4. Start typing a new string from the keyboard while the popup list is open.
5. Note the different behaviors between Windows and Linux versions of the combo sample. The Windows version allows alphanumeric key strokes at the time the popup is open, and closes the popup on first key stroke, registering all alphanumeric key strokes in the edit box. The Linux version, however, blocks all alphanumeric key strokes while the popup is open and no key strokes get to the control's edit box.
Programming advice appreciated:
We would appreciate any advice on how to get the Linux version of our wxOwnerDrawnComboBox to behave like the Windows version does - especially when the popup list is open. We want the user of the Linux version to be able to simply start typing alphanumeric characters into the edit box while the popup is open - closing the popup (at the first such key stroke) and register those characters within the control's edit box. Thank you in advance for any help you can offer.
We are developing the application using the following:
wxWidgets version 3.0.4
Platforms: Windows, Linux, Mac OSX
Source code of project is at: https://github.com/adapt-it
Note: Our Mac OSX developer is checking to see which behavior exhibits in the Mac OSX combo sample.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by ONEEYEMAN »

Hi,
Is 3.1 exhibits the same behaviour?

Also, why do you need wxOwnerDrawComboBox? Is wxComboBox not enough?
Usually the former is used when you want to display some kind of graphics along with the text...

Thank you.
pngbill
In need of some credit
In need of some credit
Posts: 5
Joined: Thu May 24, 2018 4:10 pm

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by pngbill »

The more generic wxComboBox does not have the ability to use a different button on the combo control when we need it via SetButtonBitmaps() (to present an 'X' button to indicate visually that no translations are available). The generic control also does not have the ability to adjust the control's edit box and popup's size/position/margins, all features we need to control for exotic fonts - especially in Asian languages. Also there are a number of other wxComboCtrl methods that wxOwnerDrawnComboBox inherits that we need access to that aren't available in wxComboBox, for example ::GetTextCtrl(), etc.

The wxWidgets-3.1.1 combo sample has the same behaviors as the wxWidgets-3.0.4 combo sample with the same differing behaviors between the Linux and Windows versions. The reason we use wxWidgets for our Windows, Linux and Mac OSX versions is to ideally have the same behaviors for our users on all three platforms.
pngbill
In need of some credit
In need of some credit
Posts: 5
Joined: Thu May 24, 2018 4:10 pm

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by pngbill »

[Additional information to last post] The wxComboBox itself exhibits the same differences in behavior between the Linux and Windows versions, so even if we had derived our Translation Chooser control from wxComboBox, the Linux version would still not be able to register alphanumeric characters while the popup list is in an open state.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by ONEEYEMAN »

Hi,
What version of GTK+ do you use exactly?
Did you try wxChoice (AKA wxComboBox with wxCB_READONLY) or wxComboBox with wxCB_DROPDOWN?

Thank you.
pngbill
In need of some credit
In need of some credit
Posts: 5
Joined: Thu May 24, 2018 4:10 pm

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by pngbill »

The Linux version of our application supports Ubuntu Linux version from Trusty 14.04 through the latest Bionic 18.04, and depends on what the particular distribution provides. Generally, the Linux application is built with a Build-Depends on libwxgtk3.0 (libwxgtk3.0-0v5).

We do not want the control to be created with wxCB_READONLY since the control must be editable and the user free to add a new translation at any time in the control's edit box. The control itself is created using the style flags: wxCB_DROPDOWN | wxTE_PROCESS_ENTER.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by ONEEYEMAN »

Hi,
I believe you are talking about wxGTK. I asked what version of GTK+ libraries wx is build against.
Also, my another remark is for the test you did on the wxComboBox.

Thank you,
pngbill
In need of some credit
In need of some credit
Posts: 5
Joined: Thu May 24, 2018 4:10 pm

Re: [wxGTK] wxOwnerDrawnComboBox not accepting chars when popup list is open

Post by pngbill »

My original inquiry still stands. I would appreciate any help in determining how/where in wxWidgets library sources, I can attempt to make the Windows, Linux and Mac versions of wxOwnerDrawnComboBox behave similarly - especially with respect to alphanumeric key events when the popup list is open. On Windows the edit box accepts alphanumeric key events, but not so on Linux and the Mac. The same behavioral differences are clearly seen in the wxWidgets combo sample.
Thanks in advance for some guidance.
Post Reply