Goto a TAB by click of a button

Created
Nov 22, 2021 06:56 AM
Tags
configuration
java
Status
Completed
Created Date
 
I recently came across a requirement to open a tab by click of a button. I search documentation and couldn’t find anything relevant.
Today we will explore two ways to do it. With and without code.

Procedure

Open application designer and open the relevant application in it.
In Application Designer, note down the Control ID of the tab you want to switch to. Right click the Tab and select properties.
notion image
  1. Without Code
    1. Then select the button you want to perform the action from. Open its properties. In the targetid field enter the id of the TAB. That’s it.
      notion image
  1. Java
    1. The same can be done with the help of Java.
      Why one should use java when the similar can be done without any coding. Well, there are certain scenarios where you need more processing that just simply switching to a tab.
      e.g. The tab is hidden by a condition statement. You first want to make the condition false on conditional statement by java (this will make the tab visible) then focus that tab
      In your button properties in application designer, in the event field write switchtab
      Now in create or edit a webclient class file and in it define a function named switchtab
      public void switchtab() throws RemoteException, MXException, ParseException {
             WebClientEvent newEvent = new WebClientEvent("click", "insert tab ID here", "", null, null, null, -1,
                     this.clientSession);
       
             this.clientSession.queueEvent(newEvent);
         }
      Deploy the class file.