There are several places in my application where the user needs to enter a
list of strings (names of things, actually). Looking at the available
widgets, I've concluded that the wx.TextCtrl is the appropriate one to use,
with the wx.TE_MULTILINE and wx.HSCROLL styles.
My question is how the user enters a new name to the list once the first
one has been entered and is displayed in the widget. My reading suggests that
the widget's window will expand vertically as needed, and a vertical scroll
bar will be added as appropriate, but what does the user do to add a second,
or third, or fourth name to the list?
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
wx.TextCtrl doesn't expand vertically unless you resize the widget. It
will offer scrollbars if you overflow the widget's space.
The wx.TextCtrl is the same text control you have seen in hundreds, if
not thousands of applications already. It does not natively support
'entering a list of names', though you can certainly type in a name, hit
enter, and type in another name. "selecting" a name from that "list"
will be a bit awkward.
If you want a list, and you want it to be editable, you have a few
options:
1. Use a wx.TextCtrl for adding names, with a wx.ListBox for selecting
added names.
2. Use a wx.ListCtrl with a single column and editable labels along with
an 'add item' button.
3. Use a wx.TreeCtrl with hidden root, editable labels, and an 'add item'
button.
4. Use a wx.Grid with a single column, etc.
5. Hack up the mouse-click handling on the text control to create an
editable wx.ListCtrl work-alike, though you'll probably only ever get it
to select one item at a time, unless you also change background colors
yourself.
Numbers 1-3 seem reasonable, 4 and 5 may be a bit of an overkill, though
5 may be exactly what you want. *shrug*
There are several places in my application where the user needs to enter a
list of strings (names of things, actually). Looking at the available
widgets, I've concluded that the wx.TextCtrl is the appropriate one to use,
with the wx.TE_MULTILINE and wx.HSCROLL styles.
My question is how the user enters a new name to the list once the first
one has been entered and is displayed in the widget. My reading suggests that
the widget's window will expand vertically as needed, and a vertical scroll
bar will be added as appropriate, but what does the user do to add a second,
or third, or fourth name to the list?
This is probably what I want. I may use a pop-up dialog box to add the
label, then display them in a ListCtrl or ListBox.
Thanks,
Rich
···
On Sun, 4 Dec 2005, Josiah Carlson wrote:
The wx.TextCtrl is the same text control you have seen in hundreds, if not
thousands of applications already. It does not natively support 'entering a
list of names', though you can certainly type in a name, hit enter, and
type in another name. "selecting" a name from that "list" will be a bit
awkward.
2. Use a wx.ListCtrl with a single column and editable labels along with
an 'add item' button.
--
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
I've added a button to allow the user to add text to the combo box, but I'm
having difficulty placing it properly on the panel.
There are three widgets (with static text labels) within a
wx.StaticTextBox. The three fit nicely in there. What I want to do now is to
add the button in the center -- horizontally -- and below the existing
widgets in the StaticBoxSizer that holds the existing widgets. Actually, I'd
like it centered below the "Names: " comboBoc. My efforts put the button at
the right end of the row, rather than below it.
What's the technique for having multiple rows in a static box sizer?
I've added a button to allow the user to add text to the combo box, but I'm
having difficulty placing it properly on the panel.
There are three widgets (with static text labels) within a
wx.StaticTextBox. The three fit nicely in there. What I want to do now is to
add the button in the center -- horizontally -- and below the existing
widgets in the StaticBoxSizer that holds the existing widgets. Actually, I'd
like it centered below the "Names: " comboBoc. My efforts put the button at
the right end of the row, rather than below it.
What's the technique for having multiple rows in a static box sizer?
Make the StaticBoxSizer an wx.VERTICAL sizer. Put your multiple rows in there. See enclosed code.