1. how retrieve number from list box?

Ok,

I'm sorry if this is a really stupid question, but:

How do I retrieve a "number" I put into a column of a tabbed list box, so I
can increment it & put it back?  I'm assuming that the fact I'm using a
tabbed list box is irrelevant, that my question could just as well apply to
any list box.

Making use of Brian Jackson's example of a tabbed list box, I put the number
IN to the list box like this:
for L = 1 to 20 do
addItem(ColumnListBox,"abcd\t" & sprintf("%2.1f",L) & "\t\tsome text here")
end for

That works ok, the numbers 1-20 show up in the 2nd column.

Then I retrieved the number by using Brian's parse routine, which returns a
line in the list box in the form: aRow = {col1,col2,col3}, and I am trying
to use aRow[2] because that's where the addItem put the number using the
tabs.

The retrieved number shows up ok If I say:
  wPuts(MainWin, aRow[2]),

But I can't seem to operate on the returned data as a NUMBER to increment
it, no matter what I've tried, starting with "duration = aRow[2], duration
+=1", & then using various combinations of "value" & "sprint".
What am I doing wrong?

(Also, when trying to SEE what I'm operating on by printing things that
"ought" to be the number to the screen, if I put:
  wPuts(MainWin, "          ")
just before
  wPuts(MainWin, aRow[2]),
at the same setPosition, it DOESN'T blank out any previous value, which
leaves them overwriting one another, which isn't very useful.  I'd
appreciate knowing what I'm doing wrong here, too,sigh!)


Dan Moyer
feeling like an idiot

new topic     » topic index » view message » categorize

2. Re: how retrieve number from list box?

Jeeze, I finally got it.

When I was trying to use a number I retrieved from a list box, & couldn't, I
whacked at it with everything I could think of, & when I had used "value", I
forgot that the actual value was returned in the SECOND PLACE in the
sequence.

So when I used:
dummy = value(aRowData[2]), (where the number I wanted was list column 2),
and then
duration = dummy[2],
I could then use "duration" as a number just fine.

sigh.

Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu