RobotStudio event

Set a text property of TpsLabel

Options
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

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


  • granale
    Options
    ...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 
  • carlosmtz2000
    Options
    Hi,
     

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

    granale
  • carlosmtz2000
    Options
    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
  • granale
    Options
    Thank you!
     

    granale