Global variables, Message Handlers, Functions
Björnke von Gierke
bvg at mac.com
Sun Aug 25 14:59:01 CDT 2002
On Sonntag, August 25, 2002, at 08:34 , Benjamin Dubois wrote:
> Hi Everyone,
> I am finally working on my first project using Revolution.
> I had to use VB for the last one... Needless to say I now try
> to think in the transcript way and I need some time to adapt.
> I also started programming with traditional languages such as C, C++,
> And No I never ever touched HyperCard or anything like it.
> So I wanted to check if I understood some thing correctly:
> 1. Functions are used when we need to return something.
> Otherwise custom handler are used for functions which would return
> void like in C, say.
Exact, you can also just use normal handlers and pass data via
variables, properties, fields... whatever is best for your need.
> 2. The keyword 'global' is the same as a global variable defined in C
> but we hace to declare in all the handler, we use it.
> Which kind of freak me out. I am like wait if I declare it again
> it is going to think it is a new one. I have read much
> of the documentation but I still need some time to get use to it.
A global variable is accessible from every handler which calls it. thus
you have to call it... It IS rather strange, but i guess that it makes
runrev faster (kind of explicit declaration)
> 3. Which card or stack handler should I use if I want to call a
> custom handler, when the user close the current window, substack.
> I tried closeStackRequest it launches my custom handler but the
> stack does not close (?).
closeStack is your message, as it never traps the actual closing of the
window. When you use closeStackRequest, you may use the "pass" control
structure to close the window (for example from within an "if" handler)
> Any comments, help would be greatly appreciated.
> Benjamin J. S. Dubois
> Les Esprits Sages Applications, Inc.
Thank you for your appreciation
More information about the use-livecode