Join us today!
How to Create dynamicly a user control inside another user control
Hey guys
I have an usercontrol that has all the controls of my motor, and now I made an usercontrol to control the configuration of the motor. I want to create it dynamic, so the hole application runs better on the IHM. I will share how I'm doing the code and explain line by line.
novoPopUp = TcHmi.ControlFactory.createEx( // create the configuration usercontrol 'TcHmi.Controls.System.TcHmiUserControlHost', //says its a usercontrol type nome +'.Config',// the name of it { 'data-tchmi-target-user-control': "UserControl/Popup/Motor/ucPopUpMotoresConfig.usercontrol", 'data-tchmi-top': 15, 'data-tchmi-left': 30, 'data-tchmi-width': 710, 'data-tchmi-height': 420 } ,objetoTC // the father object ); var desktop = TcHmi.Controls.get('Desktop'); // show in the desktop
With this code, I can create a new usercontrol and show it. My problem now is that I want it to be inside the already created usercontrol (the objetoTC one).
Does anyone know how to do it?
Or even if it's possible to do it?
Hello,
if you can send some images so that it is understood...
https://github.com/runtimevic
https://github.com/TcMotion
https://www.youtube.com/playlist?list=PLEfi_hUmmSjFpfdJ6yw3B9yj7dWHYkHmQ
https://github.com/VisualPLC
Hey
so the first image is the usercontrol of the control of the motor, and when i click on the gear in the right corner i opens the configuration. The thing is, its opens outside the control usercontrol (Second image) and i want it to opens inside of it
sorry if I was not so clear, I was melting my mind trying to figure this out. 😀
https://github.com/runtimevic
https://github.com/TcMotion
https://www.youtube.com/playlist?list=PLEfi_hUmmSjFpfdJ6yw3B9yj7dWHYkHmQ
https://github.com/VisualPLC
@runtimevictor Sorry I don't see where this tutorial would be helpful, it never instantiates an object dynamically.
Hello, it was in case you wanted to try another way of doing it... 😎
https://github.com/runtimevic
https://github.com/TcMotion
https://www.youtube.com/playlist?list=PLEfi_hUmmSjFpfdJ6yw3B9yj7dWHYkHmQ
https://github.com/VisualPLC
Heyyy
just for future reference, this is the code that work.
//Instancia o popup de config dentro do pai var Pai = TcHmi.Controls.get(nome + '.ucPopUpMotores'); var novoPopUp = TcHmi.ControlFactory.createEx( 'TcHmi.Controls.System.TcHmiUserControlHost', nome +'.Config', { 'data-tchmi-target-user-control': "UserControl/Popup/Motor/ucPopUpMotoresConfig.usercontrol", 'data-tchmi-top': 30, 'data-tchmi-left': 10, 'data-tchmi-width': 710, 'data-tchmi-height': 420 } ,Pai ); novoPopUp.setZindex(5000); if (Pai && novoPopUp) { Pai.__addChild(novoPopUp); }
Could you also share the code to close that pop up?
- 17 Forums
- 267 Topics
- 942 Posts
- 1 Online
- 722 Members