This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GUI Composer: How to set a target value from app.js

Other Parts Discussed in Thread: CCSTUDIO

Hi,

I'd like to modify the app.js file to pass a value from a widget to a target variable when I click a button.

For this reason, I attached on "button" events> onClick: settext


on app.js

require(["dojo/ready"], function(ready){
     ready(function(){
        
         // logic that requires that Dojo is fully initialized should go here

     });
});

function settext() {
            var y = dijit.byId('widget_137').get('value');

           targetVariable = y;
    };

It does not work....

It does not set the value of y to the trarget variable "targetVariable".

What i'm missing?

I think my fault is on the calling of the targetVariable...

One solution that I found was to create a GUI VAR y and bind it to the targetVariable, but I'd like to have a solution in app.js file

  • Take a look at this wiki page documenting the method to call a DSS function, http://processors.wiki.ti.com/index.php/GUI_Composer/DSS_Scripts. And this forum post as well https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/328460.

    In your case, create a dsScript.js file in your project root and add this snippet to the file.

    importPackage(Packages.com.ti.ccstudio.scripting.environment);
    var debugServer = ScriptingEnvironment.instance().getServer('DebugServer.1');
    function eval(exp) {
        var session = debugServer.openSession($active_context_name);
        session.expression.evaluate(exp);
    };

    In your app.js file, add this function and modify the expression that you want to pass to the eval function.

    function callDSS() {
        TI.DSS("eval", "targetVariable = 101");
    }

    Finally, add callDSS to the click event handle for the button.

    Note that binding bidirectional char array in GUI Composer is not supported at the moment. You can see the forum post how to over come this limitation at the moment.

    Patrick

  • Hi,
    I think dsScript.js is added at the CCS project.
    When i click the button that calls callDSS function js debugger i receiv tha tI is not defined...

    to add another functionality like the one descr8ibed in :
    e2e.ti.com/.../328460

    I have to create a new DSS file?

    I use CCS studio 5.5

    Thank you in advance for your help!