Question

I'm building a TableEditor using the wx backend. The table is a list of DatasetElement objects whose panel_name and dataset_name objects are exposed. Additionally, and unrelated to the problem at hand, whatever row is selected additionally displays a more detailed view of that particular DatasetElement off to the right, using the edit_view attribute (this functionality makes the TableEditor desirable as opposed to some other view style).

I am listening to the 'panel_name' attribute and, whenever it changes, for instance updating two dictionaries for which the panel name is used for rapid lookup to relevant data about the panel. This updates whenever a new character is typed into the display, so that I have two dictionaries who are constantly deleting the association {'incomplete_wor':<DataObject>} and replacing it with {'incomplete_word':<DataObject>} repeatedly as the new name is typed.

This isn't a serious problem, but is there a way to make the TableEditor update its list's members when the user hits enter or shifts the table selection, much like the enter_set keyword in a TextEditor?

Was it helpful?

Solution

If you're using ObjectColumn to display/set your values you could specify an editor for that column. By specifying the editor to be TextEditor you can adjust the enter_set parameter as needed. Below is the example that would only update the value on Enter key press.

myTableEditor = TableEditor(columns=[
   ObjectColumn(name='panel_name', label='Panel Name'),
   ObjectColumn(name='dataset_name', label='Dataset Name', 
                editor=TextEditor(enter_set = True,
                                  auto_set  = False))
                                     ])

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top