Cliff King
09-21-2007, 09:08 AM
There is an attribute (node) on every object named objectinfo that contains subnodes. The names of these subnodes become the text that is displayed next to an object when "Show Names" is checked for the view. The names of these subnodes (i.e. %Processing: 89) are updated with every screen refresh with code in the OnPreDraw event of the class object. The user may overwrite these names with their own names with code in the Custom Draw Code trigger found in the object's Properties Window. In fact there is a picklist option titled "Draw Test near Object's Name" that is available to help you do this. Adding and deleting the number of subnodes to increase or decrease the number of lines of text displayed is allowed.
Some people have asked how to query the values associated with these text displays. Although this is probably not the most direct way to do this, the following code shows you how this could be done:
treenode displaynodes = objectinfo(current);
string utilizationtext = getnodename(rank(displaynodes,3));
int totalstringlength = stringlen(utilizationtext);
int textstringlength = stringlen("%Processing: ");
int numstringlength = totalstringlength - textstringlength;
string numstring = stringpart(utilizationtext, textstringlength, numstringlength);
double utilizationnumber = stringtonum(numstring);
A more direct way to query the processing time of an object would be to query the value of the associated statelist node with code such as this:
treenode stateprofile = state_profile(current);
treenode processingnode = rank(stateprofile, STATE_PROCESSING);
double processingtime = getnodenum(processingnode);
If you prefer a percentage then add this:
double processingpercent = 100 * processingtime / time();
Some people have asked how to query the values associated with these text displays. Although this is probably not the most direct way to do this, the following code shows you how this could be done:
treenode displaynodes = objectinfo(current);
string utilizationtext = getnodename(rank(displaynodes,3));
int totalstringlength = stringlen(utilizationtext);
int textstringlength = stringlen("%Processing: ");
int numstringlength = totalstringlength - textstringlength;
string numstring = stringpart(utilizationtext, textstringlength, numstringlength);
double utilizationnumber = stringtonum(numstring);
A more direct way to query the processing time of an object would be to query the value of the associated statelist node with code such as this:
treenode stateprofile = state_profile(current);
treenode processingnode = rank(stateprofile, STATE_PROCESSING);
double processingtime = getnodenum(processingnode);
If you prefer a percentage then add this:
double processingpercent = 100 * processingtime / time();