>
> It looks like nobody here uses control arrays
> created interactively...Is this the case? I just
> wonder because I surely can't even think about
> avoiding having them even in the smallest application.
> Would anyone challenge this assumption? :)
Hi Robert,
If you create a property in an object that is an array and 'addobject'
to it,
would you then not having a control array?
In the following example look at the Objs property. It keeps the
pointers to each form that is created.
What do you mean by using the control arrays interactively. You could
use the same system in forms
at design time, under class, create properties/methods, you _can_ create
arrays as properties. Would that then be interactive?
How this enhances polymorphism is not clear to me either.
Regards,
Marc
***
*** ----------------------------------------
***
define class formsBase as cusBase
* MG 06/10/96
* Forms of class vfp.frmRegistered are compliant. It means
* that they carry a oFormsNr property that corresponds to this.Nr
* It is set at creation.
* Registered forms also set this.ActiveNr to their oFormsNr, so
* this.Accept can check if the current textbox valid is ok.
*
* Not all forms are registered. At the moment we write this,
* we think that non registered forms _must_ be modal!
*
dimension objs(1)
Nr= 0
ActiveNr= 0
** ---------------------------------
procedure Accept
** ? what if in current field there is an invalid entry?
local x
** is there a validatable field active?
if this.ActiveNr= 0
return
endif
if this.Objs[this.ActiveNr]= .null.
return
endif
if type('this.Objs[this.ActiveNr].ActiveControl')<>'O'
return
endif
if this.Objs[this.ActiveNr].ActiveControl<>.null.
return
endif
do case
** textboxes
case
upper(this.Objs[this.ActiveNr].ActiveControl.baseclass)='TEXTBOX'
x= this.Objs[This.ActiveNr].activecontrol.valid()
if type('x')='N'
if x= 0
return .f.
endif
endif
if type('x')= 'L'
return x
endif
endcase
** ---------------------------------
procedure NextForm
this.Nr= this.Nr+1
dimension this.objs(this.Nr)
** ---------------------------------
procedure doForm(xName)
if !this.Accept()
return
endif
this.Nextform()
this.ActiveNr= this.Nr
this.objs(this.Nr)= createobj(xName)
this.objs(This.Nr).oFormsNr= this.Nr
this.objs(this.Nr).show()
** ---------------------
procedure DataSession()
if this.ActiveNr= 0
return 1
endif
if this.Objs[this.ActiveNr]= .null.
return 1
endif
return this.Objs[this.ActiveNr].DatasessionId
enddefine
If things have the tendency to go your way, do not worry. It won't last. Jules Renard.