Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > Re: Global Vari...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 3257 of 3326
Post > Topic >>

Re: Global Variabldz

by "fripper" <fripper@[EMAIL PROTECTED] > Sep 7, 2007 at 05:50 PM

Wow ... I have used newsgroups for a number of years and I have never had a

reply that was as complete and helpful as yours!  I think I have may have 
stumbled onto a really neat programming environment ... on first blush 
REALbasic 2007 Release 3 seems to fit the bill for creating local apps for

the Mac (and PC) and, after poking around in this newsgroup it appears
users 
are anxious to help newcomers ... certainly you helped me.  My only
concern 
now about moving from a PC to a Mac is the apparent lack of a way to use 
REALbasic to create what I call "intelligent websites" ... websites that, 
for example, allow me to read/write/modify files (stored on the server)
when 
the user clicks certain buttons ... the equivalent to .Net's aspx files. 
In 
any evnt, I have much to learn about REALbasic but so far I am impressed 
with it and the sup****t available through this newsgroup.

Thanks for the assistance.




"Joe Strout" <joe@[EMAIL PROTECTED]
> wrote in message 
news:joe-011D81.13440207092007@[EMAIL PROTECTED]
> In article <h5Sdnfwy9r41AXzbnZ2dnUVZ_gWdnZ2d@[EMAIL PROTECTED]
>,
> "fripper" <fripper@[EMAIL PROTECTED]
> wrote:
>
>> I am an absolute newbie to REALbasic ... having used VB for the past
few
>> years.  Simple question .. how do I declare a variable that is then
>> accessibl;e from all the Event handlers and Control routines?  I see a 
>> good
>> bit about putting global functions/subs in a modules but how do I just
>> declare a variable as global?
>
> Same way as global functions/subs, but you click the "Add Property"
> button instead of the "Add Method" one.
>
>> An example would be helpful.
>
> No problem:
>
> 1. Start a new project.
> 2. Click the Add Module button (or use the Project > Add submenu).
> 3. Double-click Module1 to open its editor.
> 4. Click the Add Property button.
> 5. Set its name to "gFoo" and its type to "String".
> 6. Click the global scope button (looks like a little globe).
>
> Now, anywhere in your code, you can refer to it by name:
>
>  gFoo = "bar"
>
> But note that this is generally considered bad form, for all the reasons
> that global variables are considered evil.  A somewhat better approach
> would be to set its scope to Protected (the middle, yellow caution
> icon), which still lets you access it anywhere, but only prefixed with
> the module name:
>
>  Module1.gFoo = "Global variables suck!"
>
> Of course you'd want to name Module1 something more descriptive.  But
> this lets you group your "global" data by topic, and avoids cluttering
> the global namespace.  It also makes it obvious, any time you're looking
> at your code, exactly what "gFoo" is (i.e. a module or shared class
> property, rather than a local variable or a global defined
> who-knows-where).
>
> Best,
> - Joe
>
> -- 
> "Polywell" fusion -- an approach to nuclear fusion that might actually 
> work.
> Learn more and discuss via: 
> <http://www.strout.net/info/science/polywell/>
 




 7 Posts in Topic:
Global Variabldz
"fripper" <f  2007-09-07 14:47:07 
Re: Global Variabldz
Joe Strout <joe@[EMAIL  2007-09-07 13:44:03 
Re: Global Variabldz
Anic <sans@[EMAIL PROT  2007-09-07 22:35:15 
Re: Global Variabldz
"fripper" <f  2007-09-07 17:50:57 
Re: Global Variabldz
Joe Strout <joe@[EMAIL  2007-09-07 16:39:56 
Re: Global Variabldz
befr@[EMAIL PROTECTED] (  2007-09-10 16:55:19 
Re: Global Variabldz
Joe Strout <joe@[EMAIL  2007-09-10 10:57:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:52:51 CDT 2008.