timefortea
23 Oct 2008, 2:20 AM
Hi,
I'm confused. Every time I think I know how to use the Event Model, I get it wrong. How do I read the JavaDocs and know what I need to do? For example, I want to set a listener on a Tree, which is fired when I right-click on it to get a context menu (the context menu itself and its listeners are all working ok). So I checked out the JavaDocsfor Tree:
ContextMenu : TreeEvent(tree)
Fires before the tree's context menu is shown.
component : this
I'm not entirely clear on what this means I need to write, but I had a go:
<snip>
contextMenu.addListener(Events.ContextMenu, new Listener<TreeEvent>()
{
public void handleEvent(TreeEvent ce)
{
//TreeItem item = (TreeItem)tree.getSelectionModel().getSelectedItem();
Info.display("Message", "You right clicked on the menu");
}
});
<snip>
This doesn't seem to fire the listener. So I want to know how to do this - but more importantly I'd like to know how to use the listeners so that I don't have to ask this question the next time I need to use a different one. Is this (definitive) information available?
Many thanks.
I'm confused. Every time I think I know how to use the Event Model, I get it wrong. How do I read the JavaDocs and know what I need to do? For example, I want to set a listener on a Tree, which is fired when I right-click on it to get a context menu (the context menu itself and its listeners are all working ok). So I checked out the JavaDocsfor Tree:
ContextMenu : TreeEvent(tree)
Fires before the tree's context menu is shown.
component : this
I'm not entirely clear on what this means I need to write, but I had a go:
<snip>
contextMenu.addListener(Events.ContextMenu, new Listener<TreeEvent>()
{
public void handleEvent(TreeEvent ce)
{
//TreeItem item = (TreeItem)tree.getSelectionModel().getSelectedItem();
Info.display("Message", "You right clicked on the menu");
}
});
<snip>
This doesn't seem to fire the listener. So I want to know how to do this - but more importantly I'd like to know how to use the listeners so that I don't have to ask this question the next time I need to use a different one. Is this (definitive) information available?
Many thanks.