Search code examples
capl

Doesn't know about keyword 'this' in CAPL programming


I am new to CAPL programming. I didn't understand what is the use of this keyword. Any body please explain?


Solution

  • this is basically a pointer, addressing the Simulation event, and its scope is within only that event. You have no obligation to use it, but it does make life a lot simpler. For Example:

            on envVar Env_DTC_ReadSnapshotButton
            {
               if(getValue(this))             
                {
                  UpdateSnapshotResultsPanel();
                }
            }
    

    you can replace getValue( this ) with getValue ( Env_DTC_ReadSnapshotButton ). The application of this is the same for all other similar simulation events like on message. The decision is yours, choose the one which you feel is simpler to understand.