transfering text?? please help!!

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

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

transfering text?? please help!!

Post by smash » Sat Aug 23, 2008 9:50 am

ok, i have 3 text boxes and 1 drop down choice box.
text box for putting in peoples name
text box for putting in animals name
text box for putting in animal number
choice box has 2 options (for argument sake)
now, what i am trying to work out is,
if they pick choice number 1, i want name of person, animal and number to go to a choice 1 card.
but if they pick choice 2 i want the person, animal and number to go to a choice 2 card.
can anyone please help me??
please remember i am female and REAL DUMB so need understanding person to hold my hand and walk me through this, if it can be done

if it helps anyones,
i am blonde
i am beautiful
i have a carton of beer under my arm

please keep your eyes close as the "vision" will be lost on opening of eyes.
thank you
Last edited by smash on Sat Aug 23, 2008 10:54 pm, edited 1 time in total.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sat Aug 23, 2008 11:06 am

Women are smarter then Men. I hope this helped.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sat Aug 23, 2008 11:11 am

As for the coding question, I guess you want to put stuff from the fields into another field on two other cards, responding to the user making a choic in a drop down:

Code: Select all

on menuPick thePick
  if thePick = "Choice 1" then
    put field "people" && field "animals" && field "number" into field "result" of card "Name of card 1"
    go card "name of card 1"
  else if thePick = "Choice 2" then
    put field "people" && field "animals" && field "number" into field "result" of card "Name of card 2"
    go card "name of card 2"
  end if
end menuPick
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

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

Post by smash » Sat Aug 23, 2008 11:26 am

oh BvG
not this little black duck
i am afraid i am failing the normal female band LOL
i am off to try your reply, and i thank you so much for your help.
"ill be back"
cheers

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sat Aug 23, 2008 11:33 am

BvG wrote:Women are smarter then Men. I hope this helped.

:D :D :D :D :D :D :D :D

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

Post by smash » Sat Aug 23, 2008 11:52 am

ok, what am i doing wrong?
it keeps comming up with
on menupick thepick
if thepick = "choice is 1.1" then
put field "bridlenumber" &&field "horsesname" &&field "ridersname" into field "result" of card "compleat show entries (3)"
end menupick

_compiling at 8:51:48 PM
Type_if: missing 'end if'
Object_ComboBox Menu
Line_end menupick
Hint_
i only put the first choice in to see if it would work.

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

Post by SparkOut » Sat Aug 23, 2008 12:03 pm

The error message states that you're missing the "end if" declaration, so:

Code: Select all

on menuPick thepick 
  if thepick = "1.1" then
    put field "bridlenumber" && field "horsesname" && field "ridersname" into field "result" of card "compleat show entries (3)" 
  end if
end menuPick
The "end if" declaration above the end menuPick was missing. Also, I'm guessing that the contents of the choice drop down will just be "1.1" etc (rather than "choice is 1.1") so you should put exactly what is in the drop down option into the "if" test statement.

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

Post by smash » Sat Aug 23, 2008 12:04 pm

ok thanks sparkout.
i will try that now
cheers

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

Post by smash » Sat Aug 23, 2008 12:08 pm

ok i tried that and it came pack with

executing at 9:05:47 PM
Type Chunk: can't find card
Object ComboBox Menu
Line put field "bridlenumber" && field "horsesname" && field "ridersname" into field "result" of card "compleat show entries (3)"
Hint button id 1031 of card id 1014 of stack "C:/Program Files/Revolution Studio/Compleat Show Enteries.rev"

what does that mean.
i am so sorry i dont understand

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

Post by SparkOut » Sat Aug 23, 2008 12:20 pm

At the risk of muddying the waters, I might also suggest that the often misunderstood "switch" control structure is a way of making your options clearer.

"switch" will take out all the if/else if/end if stuff and let you avoid too much repetition of stuffing fields on a different card. As long as the fields on the different cards are the same, then you can just change the card name in the different cases, as follows:

Code: Select all

on menuPick thePick
  local theCardName

  switch thePick

    case "1.1"
        put "compleat show entries (3)" into theCardName
        break

    case "1.2"
        put "alternative card name" into theCardName
        break

  end switch

  put field "bridlenumber" && field "horsesname" && field "ridersname" into field "result" of card (theCardName)

  go card (theCardName)

end menuPick

Code: Select all

switch thePick
is the beginning of the structure and will take the value of thePick as the value to be tested for each "case" - so let's say the choice made was "1.1" - that puts "1.1" into the switch structure to be tested against the first case statement.
The first case statement

Code: Select all

case "1.1"
means that the value is matched and so the destination card name will be loaded into the local variable theCardName

Code: Select all

put "compleat show entries (3)" into theCardName
then the "break" statement means that the remaining cases should not be tested, as we've already found our match.
At the end of the switch statement theCardName variable should contain the name of the card to which you want to go, depending on whatever pick was made.
So you can just stuff the fields into the results on (theCardName) using parentheses to make the variable name evaluate and return the actual card name, and then go to the card in question.
I hope I haven't confused you with this.

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

Post by smash » Sat Aug 23, 2008 12:22 pm

yippee i worked that out.
you guys are my hero.
ok now that i have mastered that LOL :oops:
question 1
how to i make them go into the correct columns ?
question 2
actually how do i set up the colums??
question 3
as every time i type in a new name it replaces the original name

sorry as soon as i work this bit out, i think i am pretty right for a little while :oops:
cheers
edited to add, oh did i mention i was not that bright sparkout LOL
that soooo confused me LOL

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

Post by SparkOut » Sat Aug 23, 2008 12:25 pm

The error you have above means that you need to check the card name selected for the destination. It can't be found by the "put field..." statement, so check spelling of the card name. Also check is the destination a card in a substack? You might need to use the long name of the card (eg: put field "bridlenumber" && field "horsesname" && field "ridersname" into field "result" of card "compleat show entries (3)" of stack "C:/Program Files/Revolution Studio/Compleat Show Enteries.rev" ) if the spelling is definitely correct. Otherwise perhaps try going to the card by id instead of the name.

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

Post by SparkOut » Sat Aug 23, 2008 12:30 pm

smash wrote:yippee i worked that out.
you guys are my hero.
ok now that i have mastered that LOL :oops:
question 1
how to i make them go into the correct columns ?
question 2
actually how do i set up the colums??
question 3
as every time i type in a new name it replaces the original name

sorry as soon as i work this bit out, i think i am pretty right for a little while :oops:
cheers
edited to add, oh did i mention i was not that bright sparkout LOL
that soooo confused me LOL
OK :) you're getting somewhere.
You need to give a bit more info about "the columns" you're trying to set up and how/what is going on the different cards.

Is the results field a table? Usually that would be controlled by setting the "tabStops" in the property inspector. So you might replace

Code: Select all

put field "bridlenumber" && field "horsesname" && field "ridersname" into field "result" of card "blah"
with

Code: Select all

put field "bridlenumber" & tab & field "horsesname" & tab & field "ridersname" into field "result" of card "blah" 

Otherwise you need to tell more about how you're trying to set things up.

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

Post by SparkOut » Sat Aug 23, 2008 12:35 pm

As for question 3, you're probably needing to put the results "after" the field on the destination card.
"put ... into" will replace the contents of the destination.
"put ... before" will put the new stuff in front of the existing contents of the destination
"put ... after" will put the new stuff at the end of the destination, so the existing contents will remain.
If you're putting the choice into a table field in the results, you will also need to put a return character on the end of each line, so probably your code will need to be something like

Code: Select all

put field "bridlenumber" & tab & field "horsesname" & tab & field "ridersname" & return after field "result" of card "blah"
You would need to make sure the results field is emptied before you start adding the proper entries though, otherwise whatever you have saved in there before will be retained.
Last edited by SparkOut on Sat Aug 23, 2008 12:37 pm, edited 1 time in total.

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

Post by smash » Sat Aug 23, 2008 12:36 pm

damn you are good sparkout.
ok now that is working fantastic
it is going into the correct columns
but
when i enter another name, it just replaces the name instead of adding it to the next line underneith.
is there a way to do that.

i have got so much from this forum, you guys are awesome
cheers

oh and damn smart too
Last edited by smash on Sat Aug 23, 2008 12:42 pm, edited 1 time in total.

Post Reply