stubbed my toe already!

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rstevenson
Posts: 11
Joined: Thu Oct 26, 2006 8:15 pm

stubbed my toe already!

Post by rstevenson » Sun Oct 10, 2010 3:04 am

Hi,

Just starting my first LiveCode project. I used H'Card years ago, so I know just enough to hurt myself.

I'm trying to create a score card -- very simple thing. First stab was to put in a Basic Table Field. I'd figure out how to put data into it and add it up later. But I can't do something very simple with it: I can't change the width of the columns. Perhaps I shouldn't say I "can't". I don't know how would be a more accurate statement.

But I should also ask... is that the right object to use? I want a simple W or L to show, standing for Win or Loss. But when I add it up I need each W to be a 1 and each L to be a zero. So maybe something more subtle than a Table Field is necessary? (There's probably a dozen ways to do it.)

Any hints gratefully accepted.

Rob

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: stubbed my toe already!

Post by bn » Sun Oct 10, 2010 12:26 pm

Rob,
it is the tabstops of the tablefield that you have to set. You can do that either in the property inspector under table or by issueing a command : set the tabstops of field x to 15, that would make the columsn 15 pixel wide.
Look up tabstops in the dictionary. You can set the tabstops to 15,50,70 etc. Watch out they are measured in pixel from the left border of the field or from the last tabstop, depending on value -> dictionary. Tabstops work also on regular fields, they govern the width between tabs in the field.
Without knowing how many columns you need it is difficult to think about alternatives.
You could make a second field that has the numeric values of the score card field and do your math on that or convert your L and W internally by script to 1 and 0, but that is probably what you do already.

A while ago I did a table field where you can drag the dividers with the mouse and it adapts to the needed with of the columns. I have put it up on RevOnline:
http://revonline2.runrev.com/stack/428/ ... agDividers
you can copy the script of the field and copy it into your table field, it should take on the behavior.

regards
Bernd

rstevenson
Posts: 11
Joined: Thu Oct 26, 2006 8:15 pm

Re: stubbed my toe already!

Post by rstevenson » Sun Oct 10, 2010 2:16 pm

Thank you Bernd. Very kind of you to help. I'll definitely have a look at your code example. It should get me going with the table's column widths. As for calculation, I was thinking of holding it all in an array. Probably a bit overkill, but I like working with arrays. They seem such a simple structure, and given the size of what I'm working with, they won't slow down my calculations to any significant degree.

This score card is for team 8-ball (pool). There are 8 players on each team, and four rounds. I only need to keep track of the scores for the total of 16 players over four rounds, or 64 values, plus a round total and a running total. Very simple in concept and calculation. As usual, getting the UI right is most of the work.

Thanks again,

Rob

Post Reply