Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Oct 19, 2018 1:09 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: I don't get it why this works this way...
PostPosted: Sat Mar 16, 2013 7:59 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
Well i tried declaring a variable called value as an integer in Open section/sub of the TextField_TEST that i have, and then tried storing data inside of it in TextChange section/sub, but RS called an error that the variable doesn't exist, though if i put declaration of the variable in the TextChange it works...

Why is this so ?


Top
 Profile  
Reply with quote  
 Post subject: Re: I don't get it why this works this way...
PostPosted: Sat Mar 16, 2013 8:36 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
You need to make that variable a property of the window, not declared in the Open event.
You can then see and set it in any event


Top
 Profile  
Reply with quote  
 Post subject: Re: I don't get it why this works this way...
PostPosted: Sat Mar 16, 2013 9:06 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
Thanks a lot.


Top
 Profile  
Reply with quote  
 Post subject: Re: I don't get it why this works this way...
PostPosted: Sat Mar 16, 2013 9:14 am 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
To expand on that a bit, a variable only exists for the life of the object or method that declared it. If you declare a variable within a method, it goes "out of scope" as soon as the method ends. If you declare it within an If/End If block, it goes out of scope outside that block. If it's a property of a window, it's gone as soon as the window closes. And so on.

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
Reply with quote  
 Post subject: Re: I don't get it why this works this way...
PostPosted: Sat Mar 16, 2013 10:28 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
Ok.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group