Using enter for ok in MultiChoiceDialog

I’m using a MultiChoiceDialog and I’d like for the enter key to be same as clicking OK. Can this be done?

Is there a way to find the minimum width necessary to avoid truncating strings in the list?

Does tab traversal work with dialogs? I can’t seem to tab over to the OK button.

Thanks,

R.

dlg = wx.MultiChoiceDialog(self,

“Choose files to plot”,

“File List”,

self.short_file_list,

style=wx.DEFAULT_DIALOG_STYLE |

wx.RESIZE_BORDER |

wx.OK |

wx.CANCEL |

wx.CENTRE |

wx.TAB_TRAVERSAL)

# Is there a way to find the minimum width necessary to avoid truncating strings?

size = dlg.GetSize()

Empirical adjustment to display size to show entire strings

dlg.SetSize((size[0]*1.1,size[1]*1.33))

if dlg.ShowModal() != wx.ID_OK:

dlg.Destroy()

return

R.

PGP.sig (186 Bytes)

Hello Richard,

I'm using a MultiChoiceDialog and I'd like for the enter key to be same as
clicking OK. Can this be done?

Yes, this is the standard dialog behaviour, unless differently
specified by the programmer. Tried with the demo.

Is there a way to find the minimum width necessary to avoid truncating
strings in the list?

There is no need to do that, the dialog resizes itself to fit the
longest line (unless you have 80000 characters in a string). Tried
with the demo.

Does tab traversal work with dialogs? I can't seem to tab over to the OK
button.

It's working here, tried with the demo.

This is Windows XP, wxPython 2.6.3.3, Python 2.4.3. I know I may seem
repetitive, but try the demo :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/