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: Tom Benson <tombenson@mac.com>
Date: Thu, 27 Nov 2008 18:24:49 +0100
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: <FD263E05-6061-410D-9F2D-3E53B86FBFF8@tolisgroup.com>
References: <492EC3BB.1000403@chrononomicon.com> <FD263E05-6061-410D-9F2D-3E53B86FBFF8@tolisgroup.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
Namespacing has made managing my framework sooo much easier.

I now have always use a tree structure for the bulk of my framework structure

i.e. create a module named "Framework"
        - add a sub module "Languages"
        - add a sub module "Globals"
        - add a sub module "Session"

add relevant constants, functions and properties to each module

now work the namespace magic...

me.text = Framework.Languages.kMyConstant
me.text = Framework.Languages.Localise("MyString")
checkBox.value = Framework.Globals.pMyGlobal
checkBox.value = Framework.Session.ReadSetting("settingName")
etc.etc...

Namespacing rocks...

- Tom

On 27/11/2008, at 5:56 PM, 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.

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

HTH,
Tim

_______________________________________________
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>