handler objects on other cards
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
handler objects on other cards
Hi,
Is it possible to force a card script handler running on card"A" to limit its field object references to only that card, without adding ( of card"A" ) after every field reference in the entire handler?
This came up when I took a card with many fields and a script that calculates values for those fields, and "added" it to another stack. If I "go to " a different card in the stack while the first card handler is still working, errors pop up because the handler wants to put a value into a field that is not on the new card, but is on the original card.
Hope that makes sense, and thanks for any help.
Ken
Is it possible to force a card script handler running on card"A" to limit its field object references to only that card, without adding ( of card"A" ) after every field reference in the entire handler?
This came up when I took a card with many fields and a script that calculates values for those fields, and "added" it to another stack. If I "go to " a different card in the stack while the first card handler is still working, errors pop up because the handler wants to put a value into a field that is not on the new card, but is on the original card.
Hope that makes sense, and thanks for any help.
Ken
Hi Ken,
I wonder why your script is still running while you go to a different card already. Figuring out why this happens and whether it is really necessary is probably an important part of the actual solution.
You could write a script that stores all values in variables until all repeat loops have finished and the values can be put into fields. Such a script might look like this.
Best,
Mark
I wonder why your script is still running while you go to a different card already. Figuring out why this happens and whether it is really necessary is probably an important part of the actual solution.
You could write a script that stores all values in variables until all repeat loops have finished and the values can be put into fields. Such a script might look like this.
Code: Select all
on longCalculation
-- zillions of lines in myData
repeat with x = 1 to (number of lines of myData)
-- do something with line x of myData
-- store values in an array if necessary
put myResult1 into myValuesArray["put short name of field 1 here"]
put myResult2 into myValuesArray["put short name of field 2 here"]
-- and so on
put myResultX into myValuesArray["put short name of field X here"]
end repeat
-- any more results to be stored?
put myResultY into myValuesArray["put short name of field Y here"]
put myResultZ into myValuesArray["put short name of field Z here"]
-- go to card with the field without bothering user
push cd
lock screen
go cd 1 -- card containing the fields that need to be filled out
-- now we're finally done and can put values into fields
repeat for each key myKey in myValuesArray
put myValuesArray[myKey] into fld myKey
end repeat
pop cd
end longCalculation
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
different, on-going tasks
Mark,
Thanks for your coding suggestion.
There is a "why" to go from one card to another while handlers are still working on each card. There is "new data" continuously being fed into each card via a socket connection to another program. Each card has its own "tasks", but I would like to be able to view the status of each card without halting the tasks being carried out on the other card.
Perhaps REV does not "like" this approach, and I need to separate the tasks into stand alone applications. This is not ideal for me, since the results of tasks on both cards are ultimately used in combination with each other in a third decision tree.
Thanks for any additional suggestions you might have.
Regards,
Ken
Thanks for your coding suggestion.
There is a "why" to go from one card to another while handlers are still working on each card. There is "new data" continuously being fed into each card via a socket connection to another program. Each card has its own "tasks", but I would like to be able to view the status of each card without halting the tasks being carried out on the other card.
Perhaps REV does not "like" this approach, and I need to separate the tasks into stand alone applications. This is not ideal for me, since the results of tasks on both cards are ultimately used in combination with each other in a third decision tree.
Thanks for any additional suggestions you might have.
Regards,
Ken
Mark,
If there is no simpler way, then adding "of card A" is probably what I will do.
It is a matter of convience not to do so, since future duplication of the handler script that is being used on card A (for use on cards "B" and "C", etc. ) is probable. Yes,
, I do know how to use an editor.
Anyway, thanks for your assistance.
Regards,
Ken
If there is no simpler way, then adding "of card A" is probably what I will do.
It is a matter of convience not to do so, since future duplication of the handler script that is being used on card A (for use on cards "B" and "C", etc. ) is probable. Yes,

Anyway, thanks for your assistance.
Regards,
Ken
Hi Ken,
Why would you duplicate a handler? Why don't you raise the handler to the level of the stack script and adjust it to make it understand parameters that contain the id of the card?
Best,
Mark
Why would you duplicate a handler? Why don't you raise the handler to the level of the stack script and adjust it to make it understand parameters that contain the id of the card?
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode