Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class Design Problem - Again
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Class Design Problem - Again
Divers
Thread ID:
01207055
Message ID:
01207055
Vues:
80
I posted a similar question not too long ago, and I still do not understand why this
doesn't work.

If you look up 'Class Member Protection and Hiding' in the help, it states:
Properties and methods in a class definition are Public by default: code
in other classes or procedures can set the properties or call the methods. 
Properties and methods that you designate as Protected can be accessed only 
by other methods in the class definition or in subclasses of the class. 
Properties and methods designated as Hidden can be accessed only by other 
members in the class definition. Subclasses of the class cannot "see" or 
reference hidden members.
So then, since everything below is part of the 'Class Definition', why then does
this not work?

The help text above says "Properties and methods designated as Hidden can be
accessed only by other members in the class definition"

The button is a member of the class definition, and should be able to
call the hidden method on the form.
oForm = CREATEOBJECT('frmMyForm')
oForm.Show(1)


DEFINE CLASS frmMyForm AS Form

	AutoCenter = .T.
	

	ADD OBJECT cmdOk AS CommandButton;
            WITH Caption = 'Test'
      

	PROCEDURE cmdOk.Click
      
    	    This.Parent.Hidden_Method()
    
        ENDPROC

	PROCEDURE cmdOk.Init()
		
		WITH This
		
		    .Top = 10
		    .Left = 10
		    .Height = 25
		    .Width = 75
	
		ENDWITH
		
	ENDPROC

	
	
	HIDDEN PROCEDURE Hidden_Method()
	
	    MESSAGEBOX('Here we are')
	
	ENDPROC
	

ENDDEFINE
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform