Consultor Eletrônico



Kbase 18165: Apptivity how to get dynamic reference to widgets
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/5/1998
Apptivity how to get dynamic reference to widgets

The K-base gives a recursive method you can use to get a widget-tree
of a form on run-time. In this way, you can see what is used in the
IFC environment and using the instanceof operator you can determine
the object that is referenced.

This example will print the tree and mark Button in front of abButton
objects.

To trigger it, you can put the following line in the event of a button

printRecursiveTree(this, "");

You will have to create a public method in the form.java file that
contains the following:

public void printRecursiveTree(View theTestView, String Offset){
netscape.util.Vector theSubViews;
theSubViews=theTestView.subviews();

for(int i = 0; i < theSubViews.size(); i++){
//tbo
//The code will print the Object and if
//it is a button set another message
if ((View) theSubViews.elementAt(i) instanceof abButton ){
System.out.println(Offset + "Button = "+ theSubViews.elementAt(i));
}
else{
System.out.println(Offset + "Object = "+ theSubViews.elementAt(i));
}
// getting the recursive tree elements of this view.
printRecursiveTree((View) theSubViews.elementAt(i),Offset + " ");
}
return;
}

TBO
08/05/1998