I have defined several wx.ListCtrl without specifying choices; that's for
the user to do. To allow the user to enter a string, I placed an 'Add'
button; it's wx.EVT_BUTTON calls a text entry dialog. All this works well,
and I can enter a string in the widget.
A representative method that calls the dialog is,
def OnNatAdd(self, event):
self.TextEntryDlg(event)
event.Skip()
and the text entry dialog is,
def TextEntryDlg(self, event):
" Used to get a new variable name"
newVar = wx.TextEntryDialog(self, 'Enter the name of a new variable.',
'Variable Name:', style=wx.OK|wx.CANCEL|wx.CENTER)
if (newVar.ShowModal() == wx.OK):
wx.MessageDialog(self, 'You entered: %s % newVar\n', 'Text Entered',
style=wx.OK|wx.ICON_INFORMATION)
newVar.Destroy()
I know that the event.Skip() needs to be replaced with code that will add
the returned text to the list control. Since up to eight strings can be
entered in the list control, what is the recommended way of adding them, one
at a time? What I'm asking, in simple terms, is how I modify both the text
entry dialog and OnNatAdd method so a returned string is added to the list
control, and this can be done repeatedly without overwriting a previously
entered string.
Thanks,
Rich
···
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863