>>>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):
>>
>>
>>* within thisform.LoadPages method - called on init and whenever the contents of controls are saved to refresh
>>
>>* some preparation codes
>>With This.pgfConfig
>> With .pgWelcomeScreenOptions
>> * Welcome message, announcement box, 2 chkboxes and 1 drop-down
>> This.SetSource(.chkShow,REC_GEN_MSG,'IsActive')
>>...
>>
>>
>>
>>Here is the SetSource method to better understand:
>>
>>Lparameters toObject, tnItemId, tcRecField
>>
>>* Some internal check here that is irrelevant for general use
>>
>>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.
>
>Thanks for your replies - but slow loading is not the issue - am trying to set properties in the Designer via automation (from a table). Am finding that Selecting Controls and using ASelObj from the command window helpful.
OK then just follow the code above. m.toObject would come from aselobj members.