realbasic-nug
[Top] [All Lists]

Re: Constants with Global Scope

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Constants with Global Scope
From: Terry Ford <tmford@shaw.ca>
Date: Thu, 27 Nov 2008 18:20:49 -0800
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <492F4895.7040604@chrononomicon.com>
References: <492EC3BB.1000403@chrononomicon.com> <FD263E05-6061-410D-9F2D-3E53B86FBFF8@tolisgroup.com> <492F4895.7040604@chrononomicon.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

On Nov 27, 2008, at 5:25 PM, Bart Silverstrim wrote:



Tim Jones wrote:
On Nov 27, 2008, at 8:58 AM, Bart Silverstrim wrote:
I tried putting in a global constant in my primary window with Add Constant and set the global scope, but when I tried setting it in another window's static text with
thatstaticbox.setString = constAppName  + "More Text"

compiles fail at constAppName, so I'm suspecting that the global constant is only accessible in the window it's declared in, despite being global?
You'll need to refer to it as window.constAppName.

I knew it was something simple I was overlooking.

Or, you could create a global module (I call mine AppGlobals) and place any application global properties, constants, classes, and methods there.

Another idea I'll keep in mind, thank you!

And thank you to everyone else who replied with these ideas too!

Another place that is global is the App subclass. Your constant needs to be addressed with the prefix "App." but they are application wide and last for the lifetime of the application. A module is most common, for a long time, was the only way to create a constant other than a local (Const) one.

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>