WidthPercentage of PPGItem

General questions and troubleshooting SOFTIMAGE©
iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

WidthPercentage of PPGItem

Post by iamVFX » 26 Dec 2012, 10:22

Is it working? Certainly not in my case, SI 2013 SP1:

Code: Select all

'example demonstrating WidthPercentage
dim oPSet,oPPGLayout
set oPSet=ActiveSceneRoot.AddProperty("CustomProperty",false,"Demo")
oPSet.AddParameter3 "P1",siString, "Default Text"
set oPPGLayout = oPSet.PPGLayout
oPPGLayout.AddRow
'Give Softimage the hint that we want the edit box to
'have extra space
set oItem = oPPGLayout.AddItem( "P1", "Parameter 1" )
oItem.WidthPercentage = 80
set oItem = oPPGLayout.AddButton( "Button" )
oItem.WidthPercentage = 20
oPPGLayout.EndRow
'Show our PPG
InspectObj oPSet
Try to change oItem.WidthPercentage values.
This code is an example from SDK page.
I've tried to refresh PPG, it's do nothing.

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 09:02
Location: Montreal Canada

Re: WidthPercentage of PPGItem

Post by xsisupport » 26 Dec 2012, 12:50

WidthPercentage doesn't work with buttons. I remember logging a bug about this back in August 2007.

It does work with other UI controls. For example, two text boxes on one row:

Code: Select all

'example demonstrating WidthPercentage
dim oPSet,oPPGLayout
set oPSet=ActiveSceneRoot.AddProperty("CustomProperty",false,"Demo2")
oPSet.AddParameter3 "P1",siString, "Default Text"
set oPPGLayout = oPSet.PPGLayout
oPPGLayout.AddRow
'Give Softimage the hint that we want the edit box to
'have extra space
set oItem = oPPGLayout.AddItem( "P1", "Parameter 1" )
oItem.WidthPercentage = 30
set oItem = oPPGLayout.AddItem( "P1", "Parameter 1" )
oItem.WidthPercentage = 70
'set oItem = oPPGLayout.AddButton( "Button" )
'oItem.WidthPercentage = 50
oPPGLayout.EndRow
'Show our PPG
InspectObj oPSet
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

Re: WidthPercentage of PPGItem

Post by iamVFX » 26 Dec 2012, 14:11

xsisupport wrote:WidthPercentage doesn't work with buttons. I remember logging a bug about this back in August 2007.
:D

Thanks for answer, Stephen!

luceric
Posts: 1252
Joined: 21 Jun 2009, 22:08

Re: WidthPercentage of PPGItem

Post by luceric » 27 Dec 2012, 20:56

I don't know if its broken for buttons, but this example looks wrong. the percentage is in term of the space left, so it should use 100% to get the remaining space, not 20%.