RJCL
RJCL

Reputation: 357

wxpython control problems when migrating from win to mac

I have a python(2.7)/wxpython program developed on windows, which I am trying to migrate to mac but am encountering some problems.

The bit I am having problems with consists of two panels:

Panel A consists of a tree control containing key=value pairs and with user editing disabled.

Panel B consists of a set of controls of various types (filePicker, textCtrl, valueCtrl, choice, checkbox, comboBox, and spinEdit), all of which are initially disabled

When the user selects a tree node the program checks the key and decides which control on panel B should be used to edit the tree node's value. Panel A then sends the relevant info to panel B using pubsub which initializes and enables the relevant control. Each control on panel B has a EVT_KILL_FOCUS event so that when the user moves away from the control, the controls value is sent back to panel A using pubsub and the tree node's value is updated and the editing control on panel B is disabled. This works fine on windows.

On mac I have the following problems:

  1. The filepicker and spinCtrl can not be disabled - this could lead to incorrect information being sent back to the treeCtrl if either of these controls inappropriately receives focus

  2. the spinctrl, choice, checkbox, and comboctrl appear not be be triggering EVT_KILL_FOCUS events and so no information is sent back to the treeCtrl. I fixed this on the choice control by binding the EVT_CHOICE. Using non-focus events for the other controls doesn't work as well and creates undesired behaviors.

So my questions are:

1: is it possible to disable the filepicker and spinCtrl on OSX?

2: is there a way to use the kill focus events of the spinctrl, choice, checkbox, and comboctrl controls on mac?

3: if fill focus events can not be used, is there an alternate event that would be triggered after editing is complete, for each of these controls?

Thanks Rob

Upvotes: 0

Views: 72

Answers (1)

RobinDunn
RobinDunn

Reputation: 6206

  1. Which version of wxPython are you using? Disabling those kinds of widgets seems to be working fine for me with current builds.

  2. For some reason Apple thought that it was a good idea to never give the keyboard focus to some types of controls, because apparently nobody would ever want to use them with anything but a mouse or trackpad. So if the widget never gets the focus, then it can never lose it and so there won't be any EVT_KILL_FOCUS for it either. You can change this in the Keyboard panel in System Preferences by setting "Full Keyboard Access" to "All Controls"

Upvotes: 2

Related Questions