PDA

View Full Version : Scope of the tab element is constrained to tab only


syarram
01-11-2005, 08:23 AM
When I try to refer an element that is part of a tab from the scripts which is outside of that tab, I am getting the error "Undefined Variable".

Please help

We are trying to call TestSearch Dialog from the inside of the tab.

<!--- Debug output --->
test_bo_customer_search.lzx:30: reference to undefined property 'testView'
test_bo_customer_search.lzx:30: undefined object does not have a property 'test123'
test_bo_customer_search.lzx:30: reference to undefined property 'test123'
lz/edittext.lzx:195: reference to undefined property 'textdisabledcolor'


<!------- ACTUAL CODE ---------->

<canvas width="760" height="800">

<script>
<!-- Global variables -->
x = 300;
y = 300;

</script>

<class name="TestSearch" layout="axis:y;spacing:2">
<attribute name="customerDialog" type="expression"/>
<attribute name="targetField" type="expression"/>
<text> The dialog begins </text>
</class>


<view layout="axis:y;spacing:2">

<modaldialog id="customerDialog" closeable="true" title="Find Customer" x="${x}" y = "${y}" >
<method name="testOpen">
Debug.write("targetField=" + this.testSearch.targetField);
this.testSearch.targetField.setText("33333");
this.open();
</method>

<TestSearch name="testSearch" customerDialog = "${parent}" targetField = "${canvas.tab1.tabpanel.testView.test123}"/>

</modaldialog>

<tabs name="tab1" id="tab1">
<tabpane name="tabpanel" id="test">
<view name="testView" id="testView">
<text id="test123" name="test123">dsfsfsf
<method event="ondata">
customerId.setText(this.getText());
</method>
</text>

<edittext id="customerId" name="custId">
</edittext>
<button> ...
<method event="onclick">
var result = customerDialog.testOpen();
</method>
</button>
</view>
</tabpane>
</tabs>

<!----------- End Of Code ----------->


</view>
</canvas>

antun
01-11-2005, 12:09 PM
testView might be getting instantiated after you are referencing it. Try adding oninit="debug.write('testView inited')" to the testView and the view that's referencing it.

-Antun