Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Handling click even on RibbonBar

$
0
0
Hello there,

I am using SmartClient Version: v10.0p_2015-01-23/PowerEdition Deployment (built 2015-01-23) with FF26.

I have a ribbonBar with with Button on it. Now on each of the button clicked I want to perform some action. But the problem I have is how do I get to know which button is clicked. Can somebody guide me.Below is my code and screenshot. By the way I am using Button instead of the IconButton as shown in the showcase.is it ok if i use this button??.


Code:

public class DBilling implements EntryPoint
{

        @Override
        public void onModuleLoad()
        {
                VLayout vLayout = new VLayout();
                vLayout.setWidth100();

                RibbonBar ribbonBar = new RibbonBar();
                ribbonBar.setLeft(0);
                ribbonBar.setTop(0);
                ribbonBar.setWidth100();

                ribbonBar.setMembersMargin(2);
                ribbonBar.setLayoutMargin(2);

                RibbonGroup orderGroup = new RibbonGroup();
                orderGroup.setTitle("New Order");
                orderGroup.setRowHeight(60);
                orderGroup.addControl(getButton("Order", "order", false));

                RibbonGroup reportGroup = new RibbonGroup();
                reportGroup.setTitle("Report");
                reportGroup.setRowHeight(60);
                reportGroup.addControl(getButton("Report", "report", false));

                RibbonGroup productGroup = new RibbonGroup();
                productGroup.setTitle("New Product");
                productGroup.setRowHeight(60);
                productGroup.addControl(getButton("Product", "cookies", false));

                RibbonGroup systemGroup = new RibbonGroup();
                systemGroup.setTitle("System");
                systemGroup.setRowHeight(60);
                systemGroup.addControl(getButton("System", "system", false));

                ribbonBar.addMember(orderGroup);
                ribbonBar.addMember(reportGroup);
                ribbonBar.addMember(productGroup);
                ribbonBar.addMember(systemGroup);

                vLayout.addChild(ribbonBar);
                vLayout.draw();

        }

        private Button getButton(String title, String iconName, boolean vertical)
        {
                final Button cssButton = new Button(title); 
        cssButton.setShowRollOver(true); 
        cssButton.setShowDisabled(true); 
        cssButton.setShowDown(true); 
        cssButton.setIcon(iconName + ".png");
        cssButton.setIconSize(32);
        cssButton.setWidth(120);
        cssButton.addClickHandler(new ClickHandler()
                {
                       
                        @Override
                        public void onClick(ClickEvent event)
                        {
                               
                                SC.say(event.getSource().toString());
                        }
                });
       
        return cssButton;
        }


Attached Images
File Type: gif sgwt1.gif (9.4 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles