PPG logic 2005-06-07 - By Bradley R. Gabe
Back Hi Bernard-
The logic property of a PPGLayout needs to be assigned all the functions it runs as one big string. When you open the PPG and activate one of the logic events, it pretty much does the equivalent of an eval to the appropriate function.
In jscript, at least, if you assign a function to something without using the brackets it automatically overloads to a string version of the function, which you may be getting your example from.
I'm not sure how you would do this for python.
-Brad
>Okay, I have been messing with this for hours now, and I can't still >my head around it. > >So I want a custom property page with a few logic. Logic does not need >to persist, the ppg is inspected in siModal mode and deleted after >that. > >Following the example in the doc as well as reading the mailing list >archive (this thread: >http://www.softimage.com/community/xsi/discuss/archives/xsi.archive.0409 /msg00616.htm), >it seems I can't get it to work. All I want is a combo box that when >it is set to the first choice, it reveals another parameter. > > > > >So I create the cpset, add a bunch of parameters: > ># Create combo box content >oElementType = oProp.addparameter3( 'ElementTypeCombo', c.siString, >'-- --- Create new' ) >aElementTypes = [ '-- --- Create new', '-- --- Create new', > 'ENVIRONMENT', 'ENVIRONMENT', > 'CHARACTERS', 'CHARACTERS', > 'PROPS', 'PROPS', > 'CAMERA_RIG', 'CAMERA_RIG', > 'LIGHT_RIG', 'LIGHT_RIG' ] > ># Create text field for new element >oNewElementType = oProp.addparameter3( 'NewElementType', c.siString, '' ) > > > > > >Then move on to the layout/logic part: > >oLayout = oProp.ppglayout >oLayout.Logic = OnInit() >oLayout.Language = "Python ActiveX Scripting Engine" > > > > > >So here is how my logic/layout functions are setup, following the >example from the scripting reference: > >def OnInit(): > ElementTypeCombo_OnChanged() > >def ElementTypeCombo_OnChanged(): > CreateLayout( oProp.ElementTypeCombo.value ) > #oProp.Refresh() > > >def CreateLayout( sValue ): > oLayout = oProp.PPGLayout > oLayout.Clear() > > oLayout.AddGroup( "Element type" ) > oLayout.AddEnumcontrol( "ElementTypeCombo", aElementTypes, "Element >type", "siControlCombo" ) > if oProp.parameters( 'ElementTypeCombo' ).value == "-- --- Create > new": > oLayout.AddString( "NewElementType", "New element type", > False ) > oLayout.EndGroup() > > > > >Now, whenever I run this, I get a type mismatch error: > ># oLayout.Logic = OnInit() ># File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", >line 527, in __setattr__ ># self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) >#COM Error: Type mismatch. (0x-7ffdfffb) - [line 97] > > > >pointing to the line > >oLayout.Logic = OnInit() > > > > >Any help would be great, as I have to admit I more or less don't have >a clue what I'm doing here. >Bernard > >--- >Unsubscribe? Mail Majordomo@(protected) with the following text in body: >unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|