RobotStudio event

Set a text property of TpsLabel

Hello,
 

I want set the text property of a TpsLabel component. It works on virtual controler very well, but on real controler not. I use RW5.13.0225. See following lines.

 


_Test.SetValue(
"3", true);
this.lMode.Text = "Grundstellungsfahrt";
_Test.SetValue(
"31", true);

In real controler the variable _Test is 3. I get also no exception.

Please, help.

 

granale

Comments

  • The variable must be declare in the controler as PERS.


  • ...yes I know. That is not the problem. My problem is, the 3rd line in my example is never called. But only on real controller!!!!
     

    granale 
  • Hi,
     

    Is this code running in the UI thread?
    Carlos Martinez
    ABB
  • ...no, it isn't. Is in a subform. But the controller is in UI-Thread. Also the Variable-Object for the change event.
     

    granale
  • The UI can be modified only by code running on a UI thread. Even if the controller was created in the UI thread, all its events are executed in a non-ui thread. If you would want to make a change in the UI, make sure to invoke the UI thread ...
     

    Sample Pseudo-code ..

     

     

    // Assumming this code runs inside a TpsForm

     

    void MyNoUIThread (....)

    {

        this.Invoke(new EventHandler(this.MyUIThread ), this, EventArgs.Empty));

    }

     


    void MyUIThread (....)

    {

       // Change of the UI

    }

     

     

     
    Carlos Martinez
    ABB
  • Thank you!
     

    granale