I haven't used confirmation dialogs in GWT before--I've only used them in straight Javascript--so take the following with a grain of salt.
On Wed, Jan 28, 2009 at 10:29 AM, joe young <keven.c...@gmail.com> wrote: > I do the following: > > public boolean doBeforeMoveNode(Tree tree, TreeNode node, TreeNode > oldParent, TreeNode newParent, int index) { > GWT.log("treePanel.onMoveNode", null); > if (oldParent.getId().equals(newParent.getId())) { > return false; > } > MessageBox.confirm("Confirm", "You are about to > move this node and its child nodes. Would you like to save your > changes to database?", > new MessageBox.ConfirmCallback() { > > public void execute(String btnID) { > if (btnID.equals("yes")) { > return true; > } > } > }); > } > > public void onMoveNode(Tree treePanel, TreeNode node, > TreeNode oldParent, TreeNode newParent, int index) { > GWT.log("treePanel.onMoveNode", null); > controller.moveNode(treePanel, node, oldParent, > newParent); > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > but clearly the error occur at > public void execute(String btnID) { > if (btnID.equals("yes")) { > return true; > } > } > since i cannot return true. > > So how do i return true in doBeforeMoveNode() when I need to wait till > MessageBox return the result (Yes)?? You're greatly confusing matters. Just use Window.confirm(): public boolean doBeforeMoveNode(Tree tree, TreeNode node, TreeNode oldParent, TreeNode newParent, int index) { GWT.log("treePanel.onMoveNode", null); if (oldParent.getId().equals(newParent.getId())) { return false; } return Window.confirm("You are about to move this node and its child nodes. Press OK to save your changes to the database, or Cancel to lose your changes."); } See the Window.confirm() doc here: http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/Window.html#confirm(java.lang.String) Ian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---