>Am building a Form with a Page Frame with many Pages with each Page containing multiple Controls. Due to the sheer number of controls I would like to set Control Properties programatically (have a table).
>
>How best to accomplish this?
For slow loading of a form, that contains a PageFrame with many pages and\or controls within, the recommended trick is to keep a page's content as a class and instantiate on demand (if that page is activated at all).
Apart from that, this is from my real world codes where I set the sources of controls in pages at runtime from an object array (you can think that as a cursor):
With This.pgfConfig
With .pgWelcomeScreenOptions
This.SetSource(.chkShow,REC_GEN_MSG,'IsActive')
...
Here is the SetSource method to better understand:
Lparameters toObject, tnItemId, tcRecField
m.toObject.ControlSource = 'thisform.oConfig.Option['+str(m.tnItemId)+'].'+m.tcRecField
Here, we are instructing to set the ControlSource of Thisform.pgfConfig.pgWelcomeScreenOptions.chkShow to our object array's REC_GEN_MSG row (an integer constant), IsActive member.
Object array looks like a table (really is loaded from a table - named oConfig and is an array property of the form:
generated from a table that has: IsActive, IntVal, cVal, ... fields
If, say, REC_GEN_MSG is 5 this means we are setting that table's recNo: 5 row's IsActive field as the controlSource (normally you use ControlSource like alias.field, here I use it as arrRecords[RecordNumber].Field - allows me to control a whole table).
Anyway, that array controlSource thing is an extra trick, the part that is related to your question is directly the SetSource method itself that you can modify as you see fit.