PDA

View Full Version : [CLOSED] SplitToolItem only reacting to drop-down arrow part



jraue
2 Jun 2008, 8:05 AM
Hi!

When I use a SplitToolItem as in the following code, the created tool item only reacts to the right part with the arrow and shows the menu as intended. However, it never reacts to clicking on the left part.

Is this a bug or just my mistake?

Thanks,

Joachim

***

final SplitToolItem toolItem = new SplitToolItem();
toolItem.setIconStyle("myStyle");
toolItem.setText("");
toolItem.setToolTip("foo");
toolItem.setMenu(menu);
toolItem.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(final ComponentEvent be) {
doNew(); // Never executed
}
});

gslender
2 Jun 2008, 12:21 PM
what left part, right part.... the explorer demo works ok - are you able to explain further what aspect of explorer is not working, or provide more code or a screenshot that explains?

darrellmeyer
2 Jun 2008, 10:26 PM
This code works fine with beta 4:


public void onModuleLoad() {
SplitToolItem toolItem = new SplitToolItem();
toolItem.setText("Test");
toolItem.setToolTip("foo");
toolItem.addListener(Events.Select, new Listener<ToolBarEvent>() {
public void handleEvent(ToolBarEvent be) {
System.out.println("Bang Bang");
}
});
RootPanel.get().add(toolItem);
}If you still have problems, then post complete test code.

jraue
2 Jun 2008, 11:45 PM
Sorry for my lack of precision. With right part, I was referring to the arrow part of the split button that triggers the menu, with the left part, the rest (basically the area that says "Split Button" in the explorer demo "Toolbar - Menu".

In the explorer demo, there is no action associated with the left part, this is why the issue cannot show itself there. Would actually be interesting to add a listener for Events.Select to the explorer demo (show a dialog or sth).

Darell, thanks for the code. I am still on beta3, so ToolBarEvent needed to be changed with ButtonEvent, but then it runs. It was my mistake, sorry and thanks for clarifying!

Cheers,
Joachim