Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Q: read-only property, the shortest implementation?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00927230
Message ID:
00927420
Vues:
22
Anatoliy,

Based on your request: "I want an instantiated object to be able to retrieve hwindow value and not able to modify it".

I've modified your class a little bit as follows:
o = NEWOBJECT('myclass',"myclass.prg")
o._hwindow = 8  && An error will result "Property _hWindow is not found" -- "not able to modify it"
?o.GethWindow() && this retrieves the _hwindow property value -- "be able to retrieve hwindow value"

DEFINE CLASS myclass As Custom
HIDDEN _hwindow
_hwindow=0  
PROCEDURE Init
	THIS.SetHWindow

PROTECTED PROCEDURE SetHWindow
	DECLARE INTEGER GetFocus IN user32
	THIS._hwindow=GetFocus()

FUNCTION GetHWindow
	RETURN THIS._hwindow
ENDDEFINE
Hope this helps.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform