Is there a way to scope shortcut to a layout?

Hi All,

Is there a way to scope shortcut to a layout (horizontallayout)?
I know they can be scoped to panels. As panels have vertical alignment of components and also have header bars by default, it doesn’t suits my requirement.

my layout is as follows: (Screenshot attached)

[Button >> Create New record]
[Text field ]
[Button search]

==============================================
Tab1 | Tab2

Please suggest this can be achieved

Regards,
Lok Bharatendu
12476.jpg

Hi all,

I have found a solution for this.

It can be done as follows:

  1. Create new Panel and set custom class
    Panel panel = new Panel();
    panel.setStyleName(“horizontal-panel”);

  2. Create one horizontallayout
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);

  3. set panel content
    panel.setContent(hl);

  4. Add your components on horizontallayout
    hl.addComponent(myComponent1);
    hl.addComponent(myComponent2);
    hl.addComponent(myButton);

  5. add action to panel
    panel.addAction(new ClickShortcut(searchButton, KeyCode.ENTER));

  6. Add the following class to your css

     .v-panel-horizontal-panel{
             height: 30px;
             border:0px solid;
             background-image: url("") !important;
     }
    
     .v-panel-horizontal-panel .v-panel-content{
             border:none;
     }
    
     .v-panel-nocaption-horizontal-panel{
             display: none;
     }
    

Regards,
Lok Bharatendu