WButton does not respect addClickListener if it is not added to the parent. It is not always possible to add to the parent as WButtons may be added to DOM nodes that is not associated to any GWT level widgets.
I found that calling onAttach() on the constructor of WButton solves this problem. Hope this gets added to the widgets lib.
Logged In: YES
user_id=172234
Originator: NO
For eg:
HTML:
<body>
<div>
<button id="someButton"></button>
</div>
</body>
Code:
WButton button=new WButton("someButton");
button.addClickListener(...); //WON't work
button cannot be added to RootPanel.get() as this will move the button out from the DIV into the BODY level. We do not want to create a panel at div unnecessarily as well. Had WButton called the onAttach() event in constructor, the above code would work.