Question
Atos
IN
Last activity: 26 Aug 2020 11:54 EDT
Can we add controls to windows form dynamically?
Hi,
Is there any option to add controls (like text/cmbbox/radio button/check box etc) to windows form from automation during execution to display data.
Depensing on the no. of results, i want to add controls to ui form and make some of them disable/read only.
Ithere is a method called create control on windows form which i can use in automation, but there are no parameters for that method
is it possible using Pega Robotics?
***Edited by Moderator Marissa to update Platform Capability tags****
In order to add a brand new control to a form, you'd have to use a C# script certainly. You would need to do a lot of work to get it added in the right place, have the right look and feel, etc... Even then, you would not be able to listen to its events in an automation since it wouldn't be a control you'd have in design. I would instead suggest hiding controls. One trick for hiding controls is to place them on panels and place those panels behind each other. In that way, all of your controls exist in design time to be used in automations. You can use the BringToFront and SendToBack methods to move panels around. You can also make controls invisible and change their visibility when you want them to be seen. This works best when you don't want users to be able to "tab" to a given control to interact with it.
If you have a truly variant set of controls (like a UI where you want to add an unknown number of text boxes based on your results), then I would suggest creating a user control in C# to handle that. You'd need access to Visual Studio for that, but then it would be re-usable and you could create that control that you could then add to your Pega Robotics Windows Form.