Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Aug 20, 2018 8:24 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: integer in Event
PostPosted: Fri Jan 04, 2013 5:27 am 
Offline

Joined: Wed Dec 26, 2012 3:28 am
Posts: 9
I have a question: in the event handlers Open () I have a variable i is declared as an integer.

how i use this variable in the other event, such as for example, close (), the Action buttons ()?

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Fri Jan 04, 2013 5:34 am 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
define your integer in the Class (i. e. Window1) as Property


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Fri Jan 04, 2013 10:27 am 
Offline

Joined: Wed Dec 26, 2012 3:28 am
Posts: 9
Thanks for the reply

How do you actually call this variable?

Maybe an example?
I'm sorry to be dumb questions. :-)


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Fri Jan 04, 2013 10:56 am 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
https://dl.dropbox.com/u/103694210/Clas ... le.rbp.zip


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Sat Jan 05, 2013 8:27 am 
Offline

Joined: Mon Aug 14, 2006 9:33 pm
Posts: 1774
These are questions of scope. When you define a variable in an event (such as the Open event) the variable goes out of scope (i. e. ceases to exist) once that event exits. By defining your variable as a property of the Window in which it appears, you can refer to that variable anywhere within the window. If you need a variable that exists between windows, you can either define it as a global variable within a module (do this sparingly), create a new class to hold the variable, or pass it from window to window.

HTH

_________________
Roger Clary
Class One Software
Educational Software for Lifelong Learning
http://www.classonesoftware.com


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Sun Jan 06, 2013 6:18 am 
Offline

Joined: Wed Dec 26, 2012 3:28 am
Posts: 9
Thanks for the reply and example.

Real Studio is a very good tool for application development. I worked only with VBA, so I am certain things a little confusing.
One more question. If the Event (Open) form open database and fill data in Listbox control. How can I read data in the Open Event use in other control framework, such as Action (Button).
I would like to use data received through TCPSocket (Data available), look for information in the database and return it back to the socket through the same device.
Link via TCpsocket me works well. I accept the string. Connection to the database is ok, successful full-Listbox control. missing part of my string processing and availability of these data in any Event or parts of applications.
I hope that is understandable question.


Top
 Profile  
Reply with quote  
 Post subject: Re: integer in Event
PostPosted: Sun Jan 06, 2013 9:42 am 
Offline

Joined: Mon Aug 14, 2006 9:33 pm
Posts: 1774
Once again, the problem is of scope. Declare the variables to hold your incoming data as properties of the window, or better yet create a class and instantiate it as a property of your window. You then have access to that data anywhere within your window.

_________________
Roger Clary
Class One Software
Educational Software for Lifelong Learning
http://www.classonesoftware.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 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