Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Jacques Hausser
Richmond

If the globals are defined in a handler, they must be defined in each handler 
using them...
if you define them at the script level, no problem

Jacques
Le 16 nov. 2009 à 17:53, Richmond Mathewson a écrit :

 tried this:
 
 on mouseDown
  global LEFTT, TOPP
  put the top of fld acre into TOPP
  put the left of fld acre into LEFTT
  grab me
  end mouseDown
 
 on mouseUp
  put the bottom of fld acre into DOWP
  put the right of fld acre into RITE
  put RITE - LEFTT into WIDD
  put DOWP - TOPP into HITE
 end mouseUp
 
 and the third line within the 'on mouseUp'
 threw a bluey
 
 ??
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

**
Prof. Jacques Hausser
Department of Ecology and Evolution
Biophore / Sorge
University of Lausanne
CH 1015 Lausanne
please use my private address:
6 route de Burtigny
CH-1269 Bassins
tel/fax:++ 41 22 366 19 40
mobile: ++ 41 79 757 05 24
E-Mail: jacques.haus...@unil.ch
***

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Colin Holgate

On Nov 16, 2009, at 11:53 AM, Richmond Mathewson wrote:

 
 and the third line within the 'on mouseUp'
 threw a bluey

Either put the global thing in each handler, or just once at the top. So this 
would work for example:

global t

on mousedown
   put random(100) into t
end mousedown

on mouseup
   put t
end mouseup



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Mark Wieder
Richmond-

Monday, November 16, 2009, 9:00:46 AM, Colin wrote:

 top. So this would work for example:

 global t

...but do you really want to do that? This would also work...

local LEFTT, TOPP

on mouseDown
   put the top of fld acre into TOPP
   put the left of fld acre into LEFTT
   grab me
   end mouseDown

on mouseUp
   put the bottom of fld acre into DOWP
   put the right of fld acre into RITE
   put RITE - LEFTT into WIDD
   put DOWP - TOPP into HITE
end mouseUp

...without the drawback of having LEFTT and TOPP sitting around in
memory until you close the IDE and possibly interfering with variables
in other stacks.

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Colin Holgate

On Nov 16, 2009, at 12:22 PM, Mark Wieder wrote:

 global t
 
 ...but do you really want to do that?


Yes, definitely, if it's part of an answer to a question about making globals 
work. Now, Richmond may well want to learn about locals too, but I was just 
answering the question he asked!


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Richmond Mathewson

Mark Wieder wrote:

Richmond-

Monday, November 16, 2009, 9:00:46 AM, Colin wrote:

  

top. So this would work for example:



  

global t



...but do you really want to do that? This would also work...

local LEFTT, TOPP

  

Thanks for that one; especially going local.

What a great Use-list; almost always somebody willing to help
extremely quickly . . .  :)
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Mark Wieder
Colin-

Monday, November 16, 2009, 9:29:30 AM, you wrote:

 Yes, definitely, if it's part of an answer to a question about
 making globals work. Now, Richmond may well want to learn about
 locals too, but I was just answering the question he asked!

g

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Richmond Mathewson

Colin Holgate wrote:

On Nov 16, 2009, at 12:22 PM, Mark Wieder wrote:

  

global t
  

...but do you really want to do that?




Yes, definitely, if it's part of an answer to a question about making globals 
work. Now, Richmond may well want to learn about locals too, but I was just 
answering the question he asked!

  


Touchy!

Actually, Colin, your advice about globals was more correct insofar as 
it answered my question,


but Mark's was pedagogically more useful as I had 'forgotten' about locals

[ the truth of it is that ever since I discovered Hypercard and escaped 
from the joys
of variable declaration (think BASIC, FORTRAN, PASCAL) I was unaware (or 
unwilling
to think about the fact) that variables could be declared in xTalk 
languages. Today,

mucking around with something that had to stay there between 2 handlers a
little bird at the back of my head started tweeting 'global' - it didn't 
tweet 'local']


Big Thanks to both of you.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Learning about GLOBALS late in life . . .

2009-11-16 Thread Colin Holgate

On Nov 16, 2009, at 1:41 PM, Richmond Mathewson wrote:

 
 but Mark's was pedagogically more useful as I had 'forgotten' about locals


I always strive to be pedagogically less useful.

Interestingly, I knew the answer not from knowing Rev, and certainly not 
HyperCard (which doesn't work that way with variables), but from Lingo. In 
Director you can do the same kind of thing, both with global variables and with 
property variables.


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution