I am not sure if this will apply to your case but usually when I have to build dynamic stuff I try to stay away from the PPG Logic assignment on the fly.

A great way to store data in the PPG is by using the grid widget, you just do not add it to the PPG Layout so it is hidden from the user. You can store almost any kind of data in it. And as it is a spreadsheet you still have all the advantages of keeping your data in an absolute relational format. Sometimes you need to serialize some times you don't. For example it I want to query some scene object, I will just store their names in grid and later I can create the com object back in a button callback by simply doing Application.Dictionary.GetObject( < full name of the object stored in the grid > ).

When there is a need to dynamically create buttons or other controls, I try to figure some way to get over that and eliminate the need of dynamic buttons altogether and instead add what ever I need in an enumcontrol as controlCombo and just add one default button (already defined in _DefineLayout callback) to do something with the currently selected item in the enumcontrol.

Alok.
On 20/08/2012 3:28 PM, Sam Cuttriss wrote:
ppg logic:
ive got an odd problem with ppg logic.
im dynamically building a ppg that includes buttons to load presets onto itself.
for basic absolute references it works great.
but i need the reference to the PPG to be relative, "PPG" ought to point to itself?

#triple quoted function
oLoadPset = '''def [Button]_OnClicked():
try:
Application.LoadPreset(r[PresetObj],[InputObj] )
Application.LogMessage("[Button]"+" pressed")

Application.SetValue(PPG.Name, "Proportions", "")
except:
Application.LogMessage("[Button]"+" failed")
'''

# replacing all scene references with resolved names etc.
oLogic = oLogic+oLoadPset.replace('[Button]',oButtonName)


for some reason i cant refer to PPG directly as the [InputObj] for my LoadPreset call.
i guess there is some subtlety to the PPG context im misunderstanding.
_sam


No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2012.0.2197 / Virus Database: 2437/5211 - Release Date: 08/20/12


Reply via email to