Visualization using methods

ludecus
2020-06-22
20 hours ago
  • ludecus

    ludecus - 2020-06-22

    I tried many things but i didn't solved my issue.

    In an visualization frame i would like to run a method by the mouse click event.
    If the button is clicked, the method should run (multiply cycles) until the method returns a value.

    My issue is, that i can't find a way within the frame.
    Do i really use to have a POU which handles the cyclic call?
    Isn't there any code behind within the frame possible?

    An other way is to use a separate HMI project and map with data sources.
    How can i map also methods? Variables, properties and transitions are mappable, why doesn't work methods?

    Thanks for your help

     
  • loraul10

    loraul10 - 2 days ago

    Hi,
    in visu properties you can replace a variable by a function call. For example, rectangle component has a "TextVariable" property where you can place a variable or a function call. This function call is executed every cycle in Visu task, and you can use to handle the mouse click through a visu local variable.

    In this post there is some example of how to use function calls in visu https://forge.codesys.com/forge/talk/Visualization/thread/ea04556dc9/

    But it's not a good practice because the code is hidden in a visu frame. I think, it's better if you use a FB associated to a visu frame.

    BR

     
  • ludecus

    ludecus - 20 hours ago

    Thank you for your response!

    Unfortunately this mouse click is - as all the other input configurations also - only an event. If the method or function runs more then one cycle, this wont work. Even if that would be bad while its hidden code. Or am i wrong?

    An other option would be, that the TextVariable would be linked to a cyclic called variable, e.g. Prg_Visu. There the variable could call a method or function until those is finished. But that will completely separate the functionality from the visualization.

     

Log in to post a comment.