CRS - オブジェクトツリー
オブジェクト順序について
Biz/Browser DTでは、オブジェクトツリーの構造をオブジェクト定義順序を保ったまま取得することができません。
Object.getChildObjectsメソッドで特定オブジェクトの子オブジェクトの情報を取得できますが、戻り値がMapで返されるため、定義順序性が保障されません。
サンプルコードにあるように、Object.insertメソッドによって、任意のオブジェクトの前にオブジェクトを追加した場合、Object.getChildObjectsメソッドで返されるMapでの順序が異なっていることがわかります。
Form Crs0231 { x = 0; y = 0; width = 644; height = 211; TextBox textbox1 { x = 232; y = 82; width = 165; height = 32; } Button button2 { x = 232; y = 20; width = 155; height = 34; } Button button1 { x = 410; y = 23; width = 177; height = 36; } Button button3 { x = 29; y = 15; width = 162; height = 35; function onTouch(e){ var objmap = Crs0231.getChildObjects(); print("insert処理前----- \n"); for( var i in objmap ){ print(objmap[i].name,"\n"); } print("--------------- \n"); var insertobj1 = new TextBox{ x = 100; y = 100; width = 165; height = 32; }; # button1の前にtextbox2を追加 ^.button1.insert( insertobj1, "textbox2" ); var insertobj2 = new TextBox{ x = 150; y = 150; width = 165; height = 32; }; # textbox2の前にtextbox3を追加 ^.textbox2.insert( insertobj2, "textbox3" ); var objmap = Crs0231.getChildObjects(); print("insert処理後----- \n"); for( var i in objmap ){ print(objmap[i].name,"\n"); } print("--------------- \n"); } } }
Biz-Collections Bizの宝箱 トップへ
Biz/Browser DT・Biz/Designer DT TIPS集 トップへ