TextToolItem edit = new TextToolItem("Edit"); //this is a button
edit.addSelectionListener(new SelectionListener<ToolBarEvent>() {
@Override
public void componentSelected(ToolBarEvent ce) {
ce.stopEvent();
MyDialog md = new
MyDialog(""+be.getSelectedItem().get("fileName"));
md.show();
}
});
class MyDialog extends DialogBox {
public MyDialog(String fileName) {
setText("test filename " +fileName);
Button ok = new Button("OK");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
MyDialog.this.hide();
}
});
setWidget(ok);
}
}
On Feb 18, 8:24 pm, rudolf michael <[email protected]> wrote:
> you're indeed mistaken ;)>>>>.e.g.
>
> Button clickButton = new Button("Open Sesame!");
> clickButton.addClickListener(new ClickListener() {
> public void onClick(Widget _sender) {
> DialogBox newDialog = new Dialog();
> ...
> newDialog.center();
> newDialog.show();
> }});
>
> you don't center and show at the same time. .center will automatically call
> .show();
> so if you're calling .center and .show in the click listener, then this is
> obvious to have 2 Dialogs being shown.
>
> malen, can you post the code that you're using to show your dialog box?
>
> regards,
> ruds
>
> On Wed, Feb 18, 2009 at 2:19 PM, Simon B <[email protected]> wrote:
>
> > Hi,
>
> > I think I had a similar problem,
>
> > I think what you may be doing is adding a click listener to the button
> > to open a dialog box, then once you have closed the dialog box, you
> > may be forgetting to remove the click listener from the button.
>
> > e.g.
> > Button clickButton = new Button("Open Sesame!");
> > clickButton.addClickListener(new ClickListener() {
> > public void onClick(Widget _sender) {
> > DialogBox newDialog = new Dialog();
> > ...
> > newDialog.center();
> > newDialog.show();
> > }
> > });
>
> > Then the next time your code runs you may be adding another click
> > listener, forgetting that the first click listener is already there,
> > which then reopens the old dialog box and the new one with one click
> > of the button.
>
> > So you need to store a handle to each ClickListener and remove it from
> > the button - clickButton.removeClickListener(ClickListener) once you
> > have closed the DialogBox.
>
> > I'm kind of reading through the lines of your question, so I may be
> > completely mistaken, if so sorry for all this gumpf.
>
> > Cheers
> > Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---