Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug on BindEvents ?!
Message
 
 
À
22/07/2005 08:21:05
Emanuele Bonin
EB Soluzioni Informatiche
Tezze S/B, Italie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01035062
Message ID:
01035072
Vues:
16
I see it in VFP8 and VFP9. It could be a bug. The workaround is to pass parameter into the form by value.
Do Form TestForm With (cText)
>A my collegue founds something that sounds like a Bug!
>The BindEvents don't work (emit an Error) if i call a form in some circumstances:
> - the form must be an scx files (not a form created programmatically)
> - In load events of the form i use bindevents to bring the init Event
> - In Init event i have some parameters
>
>If the above conditions are satisfied, i will recive an error:
>Function argument value, type, or count is invalid.
>
>Main()
>Return
>Function Main()
>	Public oApp as C_App
>
>	oApp = CreateObject('C_App')
>
>	Local oForm As Form
>
>	If File('TestForm.Scx') && Clean directory from files of previous tests
>		Delete File TestForm*.*
>	EndIf
>
>	Local cText
>	cText = 'test Parameter'
>	
>	** This Works Correctly
>	oForm = CreateObject('MyForm', cText)
>        ** Create the external form
>	oForm.SaveAs("TestForm.Scx")
>	oForm.Release()
>
>	** This Works Correctly
>	oForm = CreateObject('MyForm_NoParameters')
>        ** Create the external form
>	oForm.SaveAs("TestForm_NoParam.Scx")
>	oForm.Release()
>	
>	** This Works
>	Do Form TestForm_NoParam
>
>	** This Don't Works ... Why ?
>	** Emits an Error: Function argument value, type, or count is invalid.
>	Do Form TestForm With cText
>
>
>EndFunc
>
>Define Class MyForm As Form
>
>	Function Load()
>		oApp.OnFormLoad(This)
>	EndFunc
>	
>	Function Init(cText)
>		MessageBox(cText)
>	EndFunc
>	
>Enddef
>
>Define Class MyForm_NoParameters As Form
>
>	Function Load()
>		oApp.OnFormLoad(This)
>	EndFunc
>	
>	Function Init()
>		MessageBox('No Parameters')
>	EndFunc
>	
>Enddef
>
>
>Define Class C_App as Custom
>
>	Function OnFormLoad(oForm as Form)
>		BindEvent(oForm, 'Init', This, 'OnFormInit', 1)
>	EndFunc
>	
>	Function OnFormInit(cText)
>		MessageBox('Delegate OnFormInit')
>	EndFunc
>
>EndDefine
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform