tabwindow


  

Web3D/VR

#@extern @vr-extern-proto-object-box.wrl PROTO TabWindow [ exposedField MFNode children [] exposedField SFVec3f scale 1 1 1 exposedField SFColor color 0.3 0.3 0.3 exposedField SFFloat transparency 0 exposedField SFBool touchEnabled FALSE eventOut SFTime touchTime field SFVec2f position 0 0 field SFVec2f size 1 1 ] { DEF TRANS Transform { scale IS scale children [ Transform { translation 0 -0.2 0.01 children [ DEF SWITCH switch { choice IS children } ] } DEF BUTTONS Transformation { } ] } DEF SCRIPT Script { directOutput TRUE field SFNode switchNode USE SWITCH field SFNode buttonGroup USE BUTTONS field SFNode transformNode USE TRANS field SFVec2f position IS position field SFVec2f size IS size url "vrmlscript: function initialize() { var i = 0; transformNode.translation = new SFVec3f(position.x,position.y,0); buttonGroup.translation = new SFVec3f(0,size.y/2+0.1,0); var buttonWidth = size.x/switchNode.choice.length; var buttonPos = -size.x/2; for(i=0;i<switchNode.choice.length;i++) { buttonGroup.addChildren = Browser.createVrmlFromString( 'Button { '+ 'title \0042' + switchNode.choice[i].title + '\0042 '+ 'position '+buttonPos+' 0 0 ' + 'size '+buttonWidth+' 0.2 0 '+ '} ' ); } } " } }