Article ID: 137950
Article Last Modified on 5/7/2003
*_ there are 2 bugs here they are pointed out with comments
PUBLIC oForm
oForm = CREATEOBJECT("Form")
oForm.AddObject("myarray","ctrlarr")
oForm.myarray.Visible = 1
oForm.Visible = 1
DEFINE CLASS ctrlarr AS Container
*- Make this a control array
DIMENSION txtdim(3)
ADD OBJECT txtdim(1) AS mytext WITH Top = 10
ADD OBJECT txtdim(2) AS mytext WITH Top = 40
ADD OBJECT txtdim(3) AS mytext WITH Top = 70
PROCEDURE txtdim.VALID
LPARAMETERS nIndex
WAIT WINDOW PROGRAM() + ' ' + This.Parent.txtdim(nIndex).value
**********************************************************************
* Should be able to use this syntax this(nIndex).value not
* this.parent.txtdim(nIndex).value***
**********************************************************************
ENDPROC
ENDDEFINE
DEFINE CLASS mytext AS TextBox
**********************************************************************
* If the following two lines are changed to comments, the valid in the
* control array won't fire ***
**********************************************************************
PROCEDURE VALID
ENDPROC
ENDDEFINE
*** end code
PUBLIC oForm
oForm = CREATEOBJECT("Form")
oForm.AddObject("myarray","ctrlarr")
oForm.myarray.visible = 1
oForm.Visible = 1
DEFINE CLASS ctrlarr AS Container
*- Make this a control array
DIMENSION txtdim(3)
ADD OBJECT txtdim(1) AS textbox WITH Top = 10
ADD OBJECT txtdim(2) AS textbox WITH Top = 40
ADD OBJECT txtdim(3) AS textbox WITH Top = 70
PROCEDURE txtdim.Valid
LPARAMETERS nIndex
WAIT WINDOW This(nIndex).Value + ' ' + STR(nindex)
ENDDEFINE
The code should work. However, when you run it, no errors occur, but the
Valid event does not fire.
Additional query words: kbvfp600
Keywords: kbbug kbprogramming kbcode KB137950