Reputation: 21
I' am trying to develop a User Component for Genexus X EV 3 for Smart Devices. It's about a personalized webview, I have used it in a project, it works but only using the predefined methods that bring Genexus, I can't figure out how to call a method of the .java file, from the Genexus project. In the .control file I added the method definition:
<Methods>
<Method>
<Name>UCgoBack</Name>
<ReturnType />
<Parameters>
</Parameters>
<Signature>UCgoBack()</Signature>
</Method>
</Methods>
Genexus recognizes the user Control, I can see the method in the IntelliSense, but when I call it, is not executed. Thanks for you help.
Upvotes: 1
Views: 514
Reputation: 21
Yes, IGxControlRuntime interface must be implemented:
@Override
public void setProperty(String name, Object value) {
}
@Override
public Object getProperty(String name) {
return null;
}
@Override
public void runMethod(String methodName, List<Object> parameters) {
if (methodName.toLowerCase().startsWith("methodname")){
methodname();
}
}
and those methods must be implemented. Thank you very much Marcos for guiding me.
Upvotes: 1
Reputation: 8218
In your User Control's Android class, you need to implement the runMethod
method, that gets called by GeneXus when there is a method call.
This is the method's signature:
public void runMethod(String name, List<Object> parameters)
The name
is the method name as defined in your .control
file. The parameters
list should be empty in your case (because your method has no parameters).
As an example, the Horizontal Grid control has two methods, you can find the implementation in the Flexible Client (search for GxMagazineViewer.java
)
Upvotes: 2