From: Kevin A. <al...@se...> - 2004-09-12 03:07:57
|
On Sep 11, 2004, at 5:11 PM, Gregory Pi=F1ero wrote: > A combobox lets me write text in it instead of forcing me to select=20 > one of its listed choices, however this text does appear to do=20 > anything as it does not show up in .stringselection. This is even the=20= > case when I type in the exact same text as a listed choice in the=20 > combobox. > > This could be a bug depending on the desired behavior here. I believe=20= > the desired behavior should be to not allow text entry into a=20 > combobox, or giving an option to turn on text entry. But if the user=20= > is allowed to enter his own text, it should be picked up somewhere,=20 > right? > I don't believe the underlying wxPython ComboBox does anything with the=20= text the user types in the field, but rather leaves it up to you to=20 decide whether you want to do some processing. PythonCard does not bind=20= the EVT_TEXT_ENTER event, but you can handle the keyPress event, and do=20= some processing if event.keyCode =3D=3D 13, otherwise just call=20 event.skip(). That way if the user presses Return you can add the text=20= to the ComboBox list. You can use the keyPress or textUpdate event if=20 you want to look at the current text and then change the=20 stringSelection based on what the user has typed. I believe that by=20 default the selection will be changed only when the user clicks on the=20= dropdown arrow. If PythonCard is not behaving the same as the ComboBox in the wxPython=20= demo then there could be a bug in the PythonCard component, but I'm=20 pretty sure it is working the same. ka= |