New topic: 

Question about objects and scope

<http://forums.realsoftware.com/viewtopic.php?t=45931>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        bjv          Post subject: Question about objects and 
scopePosted: Thu Nov 15, 2012 11:57 am                         
Joined: Thu Nov 15, 2012 10:47 am
Posts: 2                I'm very new to RB but I have done a fair amount of 
programming using NeXTSTEP, Xcode and Delphi.

I'm confused about where to put my classes, how to instaniate them and the 
scope.

For example, in Xcode I usually instantiate my objects in the 
ApplicationDidFinishLaunching method

In RB, I created module, added my object with a few methods but I'm doing 
something wrong because when I try to access the object from a button on a 
window:

textfield1.text =str( myObject.internalYield)

I get an error message

However, if I declare everything in the mousedown function:
  dim  myobject As new sst.sstPipe
  dim myobject as sst.sstPipe
  myobject=new sst.sstPipe
  
  
  myobject.initdp(5.875,4.875,135000,1.0)
  
  textfield1.text =str( myObject.internalYield)

it works fine.

Thanks in advance,   
                             Top                timhare          Post subject: 
Re: Question about objects and scopePosted: Thu Nov 15, 2012 12:43 pm           
              
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11808
Location: Portland, OR  USA                For global objects (one defined in a 
module and set to Global or Public), you can instantiate them in either

app.Open (before the window is created)
window.Open  (after the window is created)   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to