Hello everyone. I need to develop a URCap in order to make test with some I/0. The aim is to create a Installation node with a selector of the I/0. The user can select one I/0 and set/reset for testing. The idea is to facilitate the task when it comes to testing the correct functioning of the outputs.
How can I create that? How can I manage selected I/0 and set it to a value with a button?
Take a look at this sample, it reads the collection of I/O’s and allows the user to toggle them by button push.
It sounds like what you are looking for.
Now I have more information about this type of URCap. But I have another question…
If I want to search a I/0 with a string that has been written by the user in a InputTextField, how can I implement that. In the URCap appears a loop that search the I/0 with a default name, but if I change some arguments, this script doesn’t work…
I only change the argument String to InputTextField…
When you have got the iterated IO, instead of calling String thisDefaultName = thisIO.getDefaultName(); you should get the user assigned name instead, hence String thisUserdefinedName = thisIO.getName(); and the verify if this name is the correct one or follows the correct pattern. If no name is assigned by the user, the default name will be returned.
I try it with this function, but still doesn’t work. I don’t know where is the problem, maybe in the InstallationNode you cannot access to URCap Api? In program node, the iterator for search the IO works, but in the InstallationNode no. Why, is this the reason?
The Constructor of the program node is first called when the node is inserted or a program is loaded.
The installation node constructor is called on boot, before the domain.io API is ready.
Maybe try calling this in eg. openView() instead.
Hi there! I’ve tried to put this function in OpenView, but there’s some other errors that I don’t understand.
I want to get the name of the IO using a InputTextField in the Installation HTML. With this name, I search in the library of the IO and grab the selected IO demanded by the InputTextField.
However, when I try to set the InputTextField to a String for whatever reason, I can’t. I copied part of the HelloWorldExample in order to get the idea of the InputTextField.
private static final String DEFAULT_VALUE = "tool_out[0]";
public String getNombrevariable() {
if (!model.isSet(VARIABLE1_KEY)) {
resetToDefaultValue();
}
return model.get(VARIABLE1_KEY, DEFAULT_VALUE);
}
// Esto es para el Popup del mensaje. En principio no es necesario para esta aplicación
private void setNombrevariable(String message) {
if ("".equals(message)) {
resetToDefaultValue();
} else {
model.set(VARIABLE1_KEY, message);
}
}
// Pone el nombre por defecto a la variable. También lo hace para el modelo.
private void resetToDefaultValue() {
Nombrevariable.setText(DEFAULT_VALUE);
model.set(VARIABLE1_KEY, DEFAULT_VALUE);
}
In OpenView there’s this code: @Override
public void openView() {
I’d love to know if I’m missing something super easy, or if this is a bug. So that I can fix my code, or just use a workaround.
I wasn’t able to find this use in any sample, is there any?
Any thoughts? Has anyone use successfully getIOs from Install node? Thanks!!!
Your code seems right. Just tested it out inside an InstallationNode URCap and ran. Try relooking over your initialization of your apiProvider inside the NodeContribution.