Page 1 of 1

should I use a table field?

Posted: Tue Jan 01, 2008 2:45 pm
by rstevenson
Hello all,

I need to emulate a score sheet.

The sheet has a column of drop-down buttons next to a 2-column table. Each button is used to enter a team member's name in the first cell in each row of the table. Then the user enters a W or L in the second cell (to indicate win or loss) and a script updates a total at the bottom of the column, using values of 1 for a win and 0 for a loss. Sort of like this...

team list btn | player 1 | W
team list btn | player 2 | L
team list btn | player 3 | W
... and so on ...

I have the drop down button working, entering a player's name into the first cell of each line. Now how do I make the second cell editable without the first cell being also editable, so the Ws and Ls can be entered without messing up the names? Could I trick it with an on enterfield, lock field, put cursor after tab 1, unlock field kind of thing? (I couldn't get that to work.)

Or should I use a different field type? Or simply a series of small, effectively one-celled, fields? Anyone know of examples of similar tasks I can look at?

Important factor: once this works, it will be used as the data entry front-end for an on-line (web site based) mySQL database.

TIA

Rob

Posted: Tue Jan 01, 2008 3:26 pm
by rstevenson
I'll just talk to myself for a while, if you don't mind. ;-)

My current field script attempt is this...

on focusIn
select after tab 1 of me
set the locktext of me to false
end focusIn

on closeField
set the locktext of me to true
end closeField

This results in an error...

Type Chunk: can't create a variable with that name (explicitVariables?)
Object Home team
Line select after tab 1 of me
Hint tab

I've been reading in the docs about fields and tabs and select and so on, but the lightbulb hasn't come on over my head yet.

Rob

Posted: Tue Jan 01, 2008 9:10 pm
by malte
Hi,


The easiest might be to use 2 fields. However, you can get what you want to work with a little bit of script:

try something like this:

set the itemDel to TAB
select befor char 1 of item 2 of me

this should select right after the first Tabstob.


You will need to trap arrowkeys, backspace, deletekey tabkey returninfield and enterinfield to make it work properly though.

Hope that helps to get you started,

Malte