Hi All!
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
bye, Emanuele!
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.