Action in button to navigate to another screen?

Hello,

I am working with Cuba and I would like to put a button on which I click and I open a new page, it is something simple but right now I do not know how to do it. As I show in the screenshot, my button is in “screen.xml” and I want that when I click on it it shows “hirePoliza1”, to be able to be in the same window, can someone help me?

Thank you,
Greetings.

Hello, @jordi.gisbert.ponsoda

First of all you should set a method that will be invoked when button is clicked:

<button caption="Click me!"
        invoke="click"/>

Then in screen controller you can define any actions for this button:

public void click() {
    // show notification
    showNotification("hirePoliza1");

    // or open other screen here
    openWindow(
            "aboutWindow",    // screen alias ("id" of screen, defined in screens.xml)
            OpenType.THIS_TAB // how this screen should be opened
    );
}

Regards,
Daniil.

1 Like

Hello,

Yes, it was just that. It’s what I needed but I did not know the names of the methods like OpenWindows and so on. Is there documentation where they can be seen? The IDE that I use also does not give me suggestions …

Thank you very much,
Greetings.

You can find detailed explanation in our documentation: link.

We recommend to use Intellij IDEA due to its wide functionality, for example it can show you all available methods for some class:

idea

Moreover we have powerful Intellij IDEA Plugin: CUBA Plugin.

Regards

Hello,

Thanks, I’ll take a look, I just use Intellij but it does not give me suggestions, I’ll need something to configure.

Greetings.

To display this suggestions you should use a hot-key. Intellij IDEA key map reference can be found here: link.