Information générale
Catégorie:
Programmation Orientée Object
Titre:
When is Hidden too Hidden?
I have written this code similarly in other languages, and all works fine, but VFP7 doesn't work. How should this be coded for VFP?
The problem is that the hidden property is not available from within the class that has defined it....
LOCAL fn as form
fn = CREATEOBJECT("FORM")
fn.Caption = 'Move into and out of each field and watch one blow up'
fn.AddObject('WithoutDefault', 'TEXTBOXWithoutDefault')
fn.WithoutDefault.Visible = .t.
fn.AddObject('WithDefault', 'TextBoxWithDefault')
fn.WithDefault.Visible = .t.
fn.Show(1)
DEFINE CLASS TextBoxAbstract as TextBox
HIDDEN MyProperty
PROCEDURE LostFocus
MESSAGEBOX('Value : ' + This.MyProperty)
ENDPROC
PROCEDURE Init
This.MyProperty = 'Working'
endproc
ENDDEFINE
DEFINE class TextBoxWithoutDefault as TextBoxAbstract
Top = 20
Left = 10
ENDDEFINE
DEFINE class TextBoxWithDefault as TextBoxAbstract
Top = 50
Left = 10
PROCEDURE LostFocus
MESSAGEBOX('Before DODEFAULT()')
DODEFAULT()
MESSAGEBOX('After DODEFAULT()')
endproc
ENDDEFINE
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement