Show local values

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
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Show local values

Post by jmburnod » Thu Mar 03, 2011 11:00 pm

Hi All,

I search if there is a way to show the value of a local variable like when the debug mode = true
(like on this snapshot)

Jean-Marc
Attachments
showlocalValue.jpg
showlocalValue.jpg (8.62 KiB) Viewed 4544 times
https://alternatic.ch

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

Re: Show local values

Post by BvG » Fri Mar 04, 2011 12:02 am

you can just put the variable, then it'll show up in the message box:

Code: Select all

put theVar
Various teststacks and stuff:
http://bjoernke.com

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

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

Re: Show local values

Post by dunbarx » Fri Mar 04, 2011 12:25 am

Jean-Marc

Can you say more about what you want? When the debugger is active, as you yourself know, a tooltip shows the value of any variable. Also, that value is displayed in the lower pane of the debugger, and can even be expanded to a separate window that stays live until dismissed. This even works with arrays, which are displayed already combined.

You can place it in the msg box as BvG indicated. But I think you are asking for something different...

Craig Newman

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Show local values

Post by bn » Fri Mar 04, 2011 12:31 am

Salut Jean-Marc,

if you want to know what the value of a script local variable is and you are not currently in the script that holds the script local varible you could make a function in that script

Code: Select all

on returnTheValueOfScriptLocalsWho
   return sWho
end returnTheValueOfScriptLocalsWho
if the script local variable is in the message path (card or stack script) you could just call it

Code: Select all

on mouseUp
   returnTheValueOfScriptLocalsWho 
   put the result into field 1
end mouseUp
if the script you are interested in is not in the message path like a button on a card you would call it

Code: Select all

on mouseUp
   call returnTheValueOfScriptLocalsWho of button 2
   put the result into field 1
end mouseUp
this way you can know what is the content of a script local variable from anywhere outside of the script the script local variable lives in.

then again I maybe did not understand exactly what you want.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Show local values

Post by jmburnod » Fri Mar 04, 2011 10:06 am

Hi All,
Thank for replys and sorry for my bad english.
then again I maybe did not understand exactly what you want
Yes Bernd, je voudrais voir la valeur de chaque variable d'un script dans un tooltip comme quand il y a une erreur dans le script (ou un breakPoint)
a tooltip shows the value of any variable
Yes, Craig. I want the same behavior all the times... and the second quarter of the moon (Bernd already works for the first one)

Kind regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Show local values

Post by bn » Fri Mar 04, 2011 11:18 am

Hi Jean-Marc,

OK, I was off with my first response. But I still dont get what exactly you want. If you want the variables if an error occurs why dont you use the debugger? It has everything you want.

Could you give an example when and how you want to use this?

You could always put your scripts into a try/catch/end try structure. In the catch you could process your variables and do with them what you want.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Show local values

Post by jmburnod » Fri Mar 04, 2011 11:56 pm

Guten Abend Bernd,
OK, I was off with my first response. But I still dont get what exactly you want. If you want the variables if an error occurs why dont you use the debugger? It has everything you want.
Could you give an example when and how you want to use this?
I can see the values of each variable of a script in a tootip when the debugger is true and there is a breakpoint or a script error
I want de same behavior without breakpoint or script error
I would use it to follow the value of variables with a simple "mouseenter" in the name of the variable in the script editor

Kind regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Show local values

Post by bn » Sat Mar 05, 2011 12:07 am

Hi Jean-Marc,

I am not shure if this is possible. The local variables only 'live' when the script is running. Otherwise I doubt that they have any values. In the script editor the scripts are not running. So I don't know of any way to get at the value of a variable if the script is not running. The debugger is a special case since it 'freezes' the execution of the script. And you would have to change the script editor. I don't think it is a good idea.

The alternative script editor Remo (formerly TRex) has some features that come close to what you want. You can step back through the values of a variable in time.

There are people here in the forum that know a lot more about this than I do, maybe they might want to comment on this.

Kind regards

Bernd

Post Reply