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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
you can use an internal visu variable to handle the click mouse, and then in the function called from TextVariable property use this variable. Please find attahced project
The method i would like to call is a method of a FB. Therefore your idea won't work.
Okay, i could use a function as wrapper to call the method. But that's not a simple solution.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
have you tried to use OnMouseDown and onMouseUp and toggle a bool, which then causes your method to be called multiple cycles (e.g. check in PLC_PRG if the bool is try and then call the method).
Datasources only support values.
Best regards,
Marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
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.
Hi,
you can use an internal visu variable to handle the click mouse, and then in the function called from TextVariable property use this variable. Please find attahced project
Thank loraul for your sample.
The method i would like to call is a method of a FB. Therefore your idea won't work.
Okay, i could use a function as wrapper to call the method. But that's not a simple solution.
Hello @ludecus,
have you tried to use OnMouseDown and onMouseUp and toggle a bool, which then causes your method to be called multiple cycles (e.g. check in PLC_PRG if the bool is try and then call the method).
Datasources only support values.
Best regards,
Marcel
Thanks for your response m.prestel.
That's exactly what i need to do, but its not a good solution. The PLC_PRG would be just a helper, which i want to eliminate.