Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / siContolStatic and AddStaticText different?
  RSS 2.0 ATOM  

siContolStatic and AddStaticText different?
Rate this thread
 
30096
 
Permlink of this thread  
avatar
  • saajjj
  • Posted: 10 September 2008 04:21 AM
  • Total Posts: 161
  • Joined: 10 June 2008 12:38 PM

Hello,
I’ve got a siControlStatic field which I’m trying to dynamically change. The problem is that if the name of the field is not “Static” the label value doesn’t change.
You can use the following code to see what I mean (works in v7):

var oPSet ActiveSceneRoot.AddProperty("CustomProperty"false"staticHell");
var 
oLayout oPSet.PPGLayout;
oLayout.Language "JScript";
oLayout.Logic changeA_OnClicked.toString() + 
                
changeB_OnClicked.toString();

var 
editorID "a1";
oPSet.AddParameter3("oName"+editorIDsiString"A_" editorID);

oLayout.addrow();
    var 
oName oLayout.AddItem("oName"+editorID""siControlStatic);
    
oName.SetAttribute(siUICX100);
    var 
obttnA oLayout.addbutton("changeA""changeA");
oLayout.endRow();

oLayout.addrow();
    var 
oName1 oLayout.AddStaticText("blabla");
    
oName1.SetAttribute(siUICX100);
    var 
obttnB oLayout.addbutton("changeB""changeB");
oLayout.endRow();


function 
changeA_OnClicked() {
    PPG
.PPGLayout.Item("oNamea1").label "Refresh_ARGH"//try commenting out
    
PPG.Refresh();
    
logmessage(PPG.PPGLayout.Item(0).name);
    
logmessage(PPG.PPGLayout.Item(0).label);
}

function changeB_OnClicked() {
    PPG
.PPGLayout.Item("Static").label "Goody " Math.round(Math.random()*100);
    
PPG.Refresh();
    
logmessage(PPG.PPGLayout.Item(2).name);
    
logmessage(PPG.PPGLayout.Item(2).label);
}

inspectobj
(oPSet);

When changeA is clicked, the value does change (as output in the script editor), but it’s not updated in the PPG display.
When changeB is clicked, the value changes perfectly.

Do I need to do something else to make changeA work properly?

Thanks.

Edit: Another interesting thing is that if we comment out the line which says ‘//try commenting out’ the logged message doesn’t show the current label value, it’s just blank.



Replies: 0
avatar
  • saajjj
  • Posted: 10 September 2008 04:29 AM

I Just checked, it’s nothing to do with AddStaticText. In the following code i’ve deleted the working AddStaticText box, and set the name of the siControlStatic box to ‘Static’. The code works fine. However, in my case, I need a few boxes with different names…

var oPSet ActiveSceneRoot.AddProperty("CustomProperty"false"staticHell");
var 
oLayout oPSet.PPGLayout;
oLayout.Language "JScript";
oLayout.Logic changeA_OnClicked.toString();

var 
editorID "a1";
oPSet.AddParameter3("Static"siString"");

oLayout.addrow();
    var 
oName oLayout.AddItem("Static""bla"siControlStatic);
    
oName.SetAttribute(siUICX100);
    var 
obttnA oLayout.addbutton("changeA""changeA");
oLayout.endRow();

function 
changeA_OnClicked() {
    PPG
.PPGLayout.Item("Static").label "Goody " Math.round(Math.random()*100);
    
PPG.Refresh();
    
logmessage(PPG.PPGLayout.Item(0).name);
    
logmessage(PPG.PPGLayout.Item(0).label);
}
inspectobj
(oPSet);

I still think it’s some sort of a refresh bug, since the values logged in the first post do reflect the correct values, they just aren’t updated on the ppg. I suppse the workaround would be to use a single line text box (which is not ideal)



Replies: 0
avatar
  • saajjj
  • Posted: 10 September 2008 05:03 AM

I’ve got my script to work by using the “Static” name and to set values I’m using PPG.PPGLayout.Item(index).label where index is figured using some silly maths :)



Replies: 0