LT_execute
Execute LabTalk script with a specific layer as the active layer. This method is equivalent to the LabTalk commands "win -o" and "layer -o".
BOOL LT_execute( LPCSTR lpcszstr, int wCntrl = 0 )
EX1
//Use LabTalk script to set X scale of the graph layers. void Layer_LT_execute_ex1() { // Call this function with a graph window active that has two layers // // Declare graph page object and point to active page in project GraphPage gpg; gpg.Create("origin"); gpg.AddLayer(); if( gpg.IsValid() ) { // Declare graph layer objects and attach to layers 1 and 2 GraphLayer gly1 = gpg.Layers( 0 ); GraphLayer gly2 = gpg.Layers( 1 ); if( gly1.IsValid() && gly2.IsValid() ) { // Use LabTalk script to set X scale of layer 1 to -10 to 10 string strScript; strScript.Format( "layer.x.from=%f; layer.x.to=%f;", -10.0, 10.0 ); gly1.LT_execute( strScript ); // Use LabTalk script to set X scale of layer 2 to 0 to 100 strScript.Format( "layer.x.from=%f; layer.x.to=%f;", 0.0, 100.0 ); gly2.LT_execute( strScript ); } else out_str( "Graph page needs to have at least two layers" ); } else out_str( "Active page is not a graph page" ); }
The Layer Object is only temporarily set as the active layer. The Layer that was active before the code executes is restored as active upon return.
origin.h