I have figured out that a combo displaying a numeric value will misbehave if the RowSource is not numeric. When I use RowSource = 0.1,0.5,1,2,3 on a form the code runs and the combo behaves. If I use RowSource = "0.1,0.5,1,2,3" the code runs but the combo gets the quotes mixed in with the first and last choices.
When I try to define a class RowSource = 0.1,0.5,1,2,3 generates an Unrecognized command verb error. If I use RowSource = "0.1,0.5,1,2,3" the code runs but the combo misbehaves.
I am aware of several work arounds: use a cursor, use an array, or initialize the RowSource in a method called from Init. I don't like any of them because they swell the code and make it difficult to follow. Does anyone care to share some wisdom?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
How about:
LOCAL lcValues lcValues = "0.1,0.5,1,2,3"
myCombo.RowSource = lcValues
See also https://hackfox.github.io/section4/s4g387.html (RowSource, RowSourceType) and https://hackfox.github.io/section4/s4g489.html (ComboBox)
from that second citation, a design note: "The behavior of lists and combos with numeric data confuses people. The key point is that, even when we think we're seeing numbers in a combo or list, we're actually seeing characters. Combos and lists cannot show numeric data. If you specify a RowSource that's numeric, FoxPro internally converts the data to character before displaying it. "
and following that,
"The Value of a list or combo (and, therefore, the ControlSource it’s bound to) can be either character or numeric. If the Value is character, it contains the text of the currently highlighted item. If the Value is numeric, by default it contains the index of that item. Before VFP 5, there was no way to get numeric data out of a list or combo. The BoundTo property lets you tell VFP to convert a numeric character string to a number before sticking it into Value or DisplayValue."
On Fri, Aug 2, 2024 at 9:41 PM Joe Yoder joe@wheypower.com wrote:
I have figured out that a combo displaying a numeric value will misbehave if the RowSource is not numeric. When I use RowSource = 0.1,0.5,1,2,3 on a form the code runs and the combo behaves. If I use RowSource = "0.1,0.5,1,2,3" the code runs but the combo gets the quotes mixed in with the first and last choices.
When I try to define a class RowSource = 0.1,0.5,1,2,3 generates an Unrecognized command verb error. If I use RowSource = "0.1,0.5,1,2,3" the code runs but the combo misbehaves.
I am aware of several work arounds: use a cursor, use an array, or initialize the RowSource in a method called from Init. I don't like any of them because they swell the code and make it difficult to follow. Does anyone care to share some wisdom?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]