put a text in the backscript

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

Post Reply
godot
Posts: 14
Joined: Tue Aug 04, 2015 8:38 pm

put a text in the backscript

Post by godot » Tue Jan 05, 2016 4:02 pm

Hi,
Does anyone know if one can put something else than a script in the backscript ? All the exemple I found use the syntax :

Code: Select all

insert script of object "XXX" into back
If I want to put the content of a property (or something that contains a string but that is not a script), how do I do ?
Last question, if it's not possible, is there a way to create an object that would be outside of the message path ?
Thanks,
Godot

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

Re: put a text in the backscript

Post by Klaus » Tue Jan 05, 2016 4:16 pm

Hi godot,
godot wrote:If I want to put the content of a property (or something that contains a string but that is not a script), how do I do ?
...
insert... into...
...
will only work with scripts!
You will need to use a global (or local) variable to store your string, if you do not want to use a custom property of an object/card/stack.
godot wrote:Last question, if it's not possible, is there a way to create an object that would be outside of the message path ?
Not sure I understand!? No object on a card/stack is in the message path per se!

Here a very good read about "message path" and how to effectively use it:
http://www.fourthworld.com/embassy/arti ... _path.html


Best

Klaus

godot
Posts: 14
Joined: Tue Aug 04, 2015 8:38 pm

Re: put a text in the backscript

Post by godot » Tue Jan 05, 2016 5:28 pm

Hi Klaus,
Thanks for the answer. First of all, you say :
You will need to use a global (or local) variable to store your string, if you do not want to use a custom property of an object/card/stack.
I actually want to use a custom property of a stack. So how would you put a custom property called say "bScript" in the backscript ? Custom properties are no scripts right ?

Secondly, concerning your remark, let me explain more broadly my problem, it may help you to understand :
I have a mainstack which Stack script contains different functions and message handlers (e.g. on keydown) that I also wanna be able to use when the ask dialog tool stack is open.
I first thought that I could put the script in the "back" using "start using..." but then when my mainstack is open, the messages will be handled twice and so the code will also executed twice (something I don't want)
Then I thought I could "store" the message handlers in the script of an object (e.g. a button) and whenever the frontstack is the ask dialog, I could execute "insert ...into " but the problem is that the handlers in the button itself will be executed (hence my question about putting the button "outside" of the message path : I meant by that that I don't want that the handlers in the object script to be executed : the button has to just serve as a container)
finally I thought I could put the code inside a custom property but then I haven't been able to put the code in the back...

Sorry for being so long, but if your or anyone could help me find an elegant way to solve this problem, it would be awesome !

Thanks again,

Godot

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: put a text in the backscript

Post by dunbarx » Tue Jan 05, 2016 5:50 pm

...that I also wanna be able to use when the ask dialog tool stack is open.
Do you mean the native ask dialog? That is blocking, so nothing really can happen until you dismiss it. You can always roll your own dialog (a separate small stack), and that would allow other processes while open.

As for your other questions, I am with Klaus. Controls are so "low" in the message hierarchy they are not really part of that hierarchy. That is, they are at the bottom, and though they can initiate messages (like "mouseUp") that can travel up the hierarchy, they sort of fall under the radar.

I wonder if you need to consider behaviors in some way.

So without really understanding your problem, a kluge might be to trap the messages of interest and only pass them under certain conditions, like perhaps whether or not that home-made "ask" stack is in front.

We may need more concrete examples to figure this out. Or you might ask someone smarter.

Craig

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

Re: put a text in the backscript

Post by Klaus » Tue Jan 05, 2016 5:51 pm

Hi godot,
godot wrote:Custom properties are no scripts right ?
that is correct.
godot wrote: So how would you put a custom property called say "bScript" in the backscript ?
You can't!
A back script is, well a SCRIPT that "sits" in the last position of the message herarchy.
godot wrote:Secondly, concerning your remark, let me explain more broadly my problem, it may help you to understand :
I have a mainstack which Stack script contains different functions and message handlers (e.g. on keydown) that I also wanna be able to use when the ask dialog tool stack is open.
I first thought that I could put the script in the "back" using "start using..." but then when my mainstack is open, the messages will be handled twice and so the code will also executed twice (something I don't want)
Then I thought I could "store" the message handlers in the script of an object (e.g. a button) and whenever the frontstack is the ask dialog, I could execute "insert ...into " but the problem is that the handlers in the button itself will be executed (hence my question about putting the button "outside" of the message path : I meant by that that I don't want that the handlers in the object script to be executed : the button has to just serve as a container)
finally I thought I could put the code inside a custom property but then I haven't been able to put the code in the back...
Sorry, still not sure I get this?! :shock:

But a mainstacks ahdlers and functions are in fact availabel to all of its substacks (aiutomatically!), so maybe you do not have to
"insert" or "start using" its script at all?

But you can always "start" and "stop" using a script or "remove" a script from front/back and "insert" again whenever necessary,
even in the same handler. Maybe that helps?

And if you do not PASS a message like "keydown" or whatever, this one will no be handled twice (by object and eventual backscript).


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: put a text in the backscript

Post by FourthWorld » Tue Jan 05, 2016 7:26 pm

godot wrote:...let me explain more broadly my problem, it may help you to understand :
I have a mainstack which Stack script contains different functions and message handlers (e.g. on keydown) that I also wanna be able to use when the ask dialog tool stack is open.
Thanks - very helpful to have that description of what you want to do. Could you also tells us why you want to do this?

Once we understand the goal you're after I'll bet we can come up with a good solution for you.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply