New topic: 

New class functions not visible

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

         Page 1 of 1
   [ 8 posts ]                 Previous topic | Next topic          Author  
Message        nicokne          Post subject: New class functions not 
visiblePosted: Tue Nov 27, 2012 2:44 pm                         
Joined: Wed Jun 27, 2012 3:26 pm
Posts: 16
Location: argentina                Hi everyone! I created a new Class named 
"Class1" and i added some functions (function1, function2 and funtion3).The 
problem is when i use these functions an ERROR message apears "this method or 
property does not exist" when i am totally sure that exists.. ¿how i could 
solve this?
Thanks folks!   
                             Top                ktekinay          Post subject: 
Re: New class functions not visiblePosted: Tue Nov 27, 2012 2:54 pm             
                    
Joined: Mon Feb 05, 2007 5:21 pm
Posts: 262
Location: New York, NY                We will need actually code. How was the 
function defined, and how are you calling it? If you copy and paste the 
function directly from your class, that would be best.      
_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.
  
                             Top                markwalsh          Post 
subject: Re: New class functions not visiblePosted: Tue Nov 27, 2012 3:09 pm    
                     
Joined: Wed May 20, 2009 4:43 pm
Posts: 908                Are you referencing a class instance or the class 
itself? You should have something like this:
Dim classInstance as new Class1
classInstance.function1()


If you are using:
Class1.function1()
then you are referencing the class itself; you need to create an instance of 
the class to use it.      
_________________
RB 2009r4 Windows XP  
                             Top                ktekinay          Post subject: 
Re: New class functions not visiblePosted: Tue Nov 27, 2012 3:13 pm             
                    
Joined: Mon Feb 05, 2007 5:21 pm
Posts: 262
Location: New York, NY                Or create it as a Shared Method instead 
of a plain Method.      
_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.
  
                             Top                nicokne          Post subject: 
Re: New class functions not visiblePosted: Tue Nov 27, 2012 10:03 pm            
             
Joined: Wed Jun 27, 2012 3:26 pm
Posts: 16
Location: argentina                markwalsh wrote:Are you referencing a class 
instance or the class itself? You should have something like this:
Dim classInstance as new Class1
classInstance.function1()


If you are using:
Class1.function1()
then you are referencing the class itself; you need to create an instance of 
the class to use it.

I tried this and does not work   
                             Top                nicokne          Post subject: 
Re: New class functions not visiblePosted: Tue Nov 27, 2012 10:06 pm            
             
Joined: Wed Jun 27, 2012 3:26 pm
Posts: 16
Location: argentina                ktekinay wrote:Or create it as a Shared 
Method instead of a plain Method.

Hi! how could i perform this?   
                             Top                timhare          Post subject: 
Re: New class functions not visiblePosted: Tue Nov 27, 2012 11:30 pm            
             
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11841
Location: Portland, OR  USA                You need to get it working as a 
normal method first.  Please post the method signature:

Name:
Parameters:
Return:
Public, Protected, or Private scope?

And post the code where you call the method.   
                             Top                ktekinay          Post subject: 
Re: New class functions not visiblePosted: Wed Nov 28, 2012 12:27 am            
                     
Joined: Mon Feb 05, 2007 5:21 pm
Posts: 262
Location: New York, NY                nicokne wrote:Hi! how could i perform 
this?
The simple answer to your question is, you use the menus to add a Shared Method 
instead of a Method, or you right-click on a Method to convert it to a Shared 
Method.

But as Tim points out, this may not be the right move. The point of a Shared 
Method is to give you a way to a call method that has nothing to do with a 
particular instance of a class. Normally, you would use Methods, not Shared 
Methods, and you would call those directly from an instance of the class. For 
example, let's say you defined a class called "MyClass" and within it, you 
defined a method as a function:
Public Function MyFunk(x As Integer) As String
  return str( x )
End Function

Within your code, you could not do this:
MsgBox MyClass.MyFunk(1)
Instead, you would need to do this:
dim c as new MyClass
MsgBox c.MyFunk(1)

On the other hand, if you had defined this as a Shared Method, you could call 
it as:
MsgBox MyClass.MyFunk(1)      
_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.
  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 8 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