ruddy table question AGAIN !!!

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

ruddy table question AGAIN !!!

Post by smash » Tue Jul 21, 2009 11:08 am

i have a check box with the script
on mouseUp
local theCardName
if the hilite of me is true then
put "Entries" into theCardName
put the label of me after theCardName
if (field "HorsesName" is not empty) and (field "RidersName" is not empty) then
put tab & tab & field "HorsesName" & tab & field "RidersName" & return after field "Entries" of card "Entries5A"
else
answer "You have not completed the entry details correctly"
end if
end if
end mouseUp
and the table they go to has the first column with times (the time column has its own button) but i CAN NOT work out how to put the "HorsesName" and "RidersName" onto the SAME ROW????
it keeps going to the very bottom AFTER the time column finishes.
what am i doing wrong ??

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Tue Jul 21, 2009 12:23 pm

Putting the new line (of horse and rider information) "after" the field will literally put the data "after" what's already in there - ie at the end.
If you already have data (the time list) in the field then you will have to do something to keep a track of what time slots are available, or use two different fields side by side (that you could maybe group together and scroll together if necessary).
If you want to put the data on the same line as the first free "time slot" then you would need to do something like

Code: Select all

on mouseUp 
local theCardName 
if the hilite of me is true then 
  put "Entries" into theCardName 
  put the label of me after theCardName 
  if (field "HorsesName" is not empty) and (field "RidersName" is not empty) then 
    put the cLineCount of field "Entries" of card "Entries5A" into tLineCount
    add 1 to tLineCount 
    set the cLineCount of field "Entries" of card "Entries5A" to tLineCount
    --this keeps a count of the used lines and stores it in a custom property
    --of the destination field. You would need to reset it to zero on emptying
    --the field.
    set the itemDelimiter to tab
    put tab & tab & field "HorsesName" & tab & field "RidersName" into item 2 to -1 of line tLineCount of field "Entries" of card "Entries5A"
    --this puts the line of data into the second column onwards of the given line
    --of course there is no error trapping here to check that the line does not already contain some data, or check availability
  else 
    answer "You have not completed the entry details correctly" 
  end if 
end if 
end mouseUp
That's a simple thing to add data to a given line, but you will probably need to look at it a big more "big picture"-wise to get a terribly good result.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Tue Jul 21, 2009 12:40 pm

thanks sparkie,
i am trying to learn all i can about tables, as there is no info that i can find about them.
your post has given me MORE HOMEWORK :D
thank you sparkie, your the best
cheers

Post Reply