Page 1 of 1

Creating field at runtime in a new card

Posted: Sat Apr 05, 2014 6:22 pm
by atout66
Hi to all (again :!: ),

From the main stack, I send a mouseUp handler to a button. It creates a new card, name it, in a existing other stack. 'till now, every thing is OK.
All the variables are correct. I can notice the new card created, with its new name in the right stack in the Application Browser.
Here is the piece of code with problem:

Code: Select all

go to card laCardCreated -- the card just created
send "createTheField leNomDuField,laCardCreated ,leNomDeLaStack" to me
-- ...
on createTheField leNomDuField,laCardCreated ,leNomDeLaStack
   create field leNomDuField in card laCardCreated -- of stack leNomDeLaStack -- with or without <leNomDeLaStack > doesn't change anything
I always get the error message: (Chunk: can't find card), char 17.
LC don't find the card while I can see its name in the browser !?!
Any idea may be ?

Kind regards.

Re: Creating field at runtime in a new card

Posted: Sat Apr 05, 2014 6:50 pm
by Klaus
Bonsoir atout66,

try this:

Code: Select all

...
go to card laCardCreated -- the card just created
## Whatever you do now, the target will be that card in that stack -> laCardCreated
## That means you should not supply and use the name of the card in your "createTheField" handler
## In fact "create xyz" does not even  allow to also supply a cardname as parameter, only GROUPnames! Sad, but true.

## But since you GO to that new card, everything should work :-)

## No need to SEND, the handler is in the message path, so just call it:
createTheField leNomDuField
...

on createTheField leNomDuField
   create field leNomDuField
end createTheField
Best

Klaus

Re: Creating field at runtime in a new card

Posted: Sat Apr 05, 2014 7:56 pm
by atout66
Thanks Klaus,

You're logical is mine :wink: As I didn't get any error with the message:

Code: Select all

go to card laCardCreated -- the card just created
the use of parameters <leNomDuField,laCardCreated ,leNomDeLaStack> is not necessary anymore, since I'm on the card. You found it out.
But I don't understand when you say
## No need to SEND, the handler is in the message path, so just call it:
createTheField leNomDuField
What do you mean by " so just call it" ?

Because I still use

Code: Select all

send "createTheField leNomDuField"
Now LC create the field in the fist card of the main stack from where the handler mouseUp come from... and not in the right card where I am supposed to be :shock:

Kind regards.

Re: Creating field at runtime in a new card

Posted: Sat Apr 05, 2014 8:12 pm
by atout66
Ah! I got it Klaus :)
I didn't understand the message path and why the <send> command was useless.
It was because of the <send> command that I had troubles after trying to fix the issue.

Thanks a lot for your help, and I hope I won't touch this computer before monday :wink:

Re: Creating field at runtime in a new card

Posted: Sat Apr 05, 2014 8:23 pm
by Klaus
atout66 wrote:Thanks a lot for your help, and I hope I won't touch this computer before monday :wink:
Hehe, I highly doubt! :D

Re: Creating field at runtime in a new card

Posted: Mon Apr 07, 2014 1:08 pm
by atout66
Klaus, you lost :wink:

Re: Creating field at runtime in a new card

Posted: Mon Apr 07, 2014 1:28 pm
by Klaus
atout66 wrote:Klaus, you lost :wink:
Avec plaisir, monsieur! 8)