Undocumented function —> gTBo()

Using XMLHttpRequest() to configure entire ToolBook pages.

Undocumented function —> gTBo()

Postby Clifton » Sat Feb 08, 2020 9:52 pm

For those who are using XML configuration files, you may find the internal PowerPac function gTBo() to be very useful.
This function enables direct access to PowerPac's Object Referencing Engine.

Syntax:
var obj = gTBo( [object, object name or id], [option] );

[option] can be one of the following:
  • [option] = "objRef" will return the DOM object with the submitted [name or id]
  • [option] = "tbObj" will return the ToolBook object with the submitted [name or id]
  • [option] = "id" will return the ToolBook id for the object with the submitted [name] OR it will return the DOM id for the object with the submitted [name]
  • [option] = "name" will return the ToolBook name OR the id in the case of a <make> object.
Example:
<!--(XML function that defines a click event on a ToolBook field; purpose is to change the styling of the field.)-->
<function name="myClick" event="click" params="evt,undef,target,mX,mY,isShift,isCntrl" useTB="true">
<![CDATA[
  var obj = gTBo( this.name, "objRef");
obj.style.border = "2px solid blue";
obj.style.padding = "10px";
obj.style.height = "auto";
obj.style.width = "auto";
obj.style.color = "rgba( 255, 128, 0, 0.5)";
]]>
</function>

While many styles are supported using pgStyleObject(), rgba() is not and so this may be the only way to access this style. The function also may be useful when accessing obj.innerHTML as well as other properties. It may also be more efficient when setting custom or user properties for objects rather than using tbfunction_userProperty().

It all comes down to convenience and readability of your code.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Return to XML Configurations – Plugin Examples

Who is online

Users browsing this forum: No registered users and 1 guest

cron