[codenameone-discussions] Re: programatically go back
Again the error callback is off the EDT. If something happens sometimes "oddly" it's a race. -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/06a0651c-f3d4-4c22-8da3-a7498a3a3591%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[codenameone-discussions] Re: programatically go back
That's a race condition. Notice that the error methods are called off the EDT so you need to use callSerially(). -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/46915acb-6c42-4a83-a362-11f733ba36b9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[codenameone-discussions] Re: programatically go back
ok, this solution works for an error situation. However I am seeing similar weird behaviour when I do: Form1 visible, click on button to show Form 2 Form2 during constructor calls toastbar and retrieves information from the server Form2 click on "back" calls parent.showBack() Form1 is reloaded but with toastbar visible and blocking. Peter On Monday, August 29, 2016 at 9:34:40 PM UTC-7, Shai Almog wrote: > > When a Dialog is disposed it goes to the form that showed it. ToastBar is > bound to a specific form so it won't work as expected either. > > The solution is to showBack() and use an addShowListener before that. > Within the show listener show your toastbar or dialog. This will do the > back transition first and then show the dialog/toast. > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/a8b3316d-0a67-4089-9225-744bc7471bbe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[codenameone-discussions] Re: programatically go back
As far as I understand it the "StateMachine" no longer exists, or at least not in the form to which you refer. At the minimum it does not exist in my project. I have noticed this weird behaviour: if I store a handle to the parent form and then call parent.showBack() - Just call parent.showBack() with no notification it will nicely go back to the previous form. - If I call Dialog.show() first and then call parent.showBack() it doesn't go back. - If I use ToastBar it does go back, but the ToastBar disappears immediately. ConnectionRequest r = new ConnectionRequest() { @Override protected void readResponse(InputStream input) throws IOException { //parse result for error } @Override protected void postResponse() { if (sResult.equals("error")) MessageBox.OK(sErrorMsg, "Unable to Save"); else { MessageBox.OK("Data Saved", "Info"); <<< Wont go back MessageBox.TOAST("Data Saved"); <<< goes back but Toast disappears immediately parent.showBack(); } } }; public class MessageBox { public static void OK(String msg, String title) { Dialog.show(title, msg, "OK", null); } public static boolean OKCANCEL(String msg, String title) { return Dialog.show(title, msg, "OK", "Cancel"); } public static void TOAST(String msg) { TOAST(msg, 2500); } public static void TOAST(String msg, int delay) { ToastBar.Status status = ToastBar.getInstance().createStatus(); status.setMessage(msg); status.setExpires(delay); status.show(); } } Peter On Sunday, August 28, 2016 at 7:40:07 PM UTC-7, shyam tha wrote: > > Please check this and hope there will not be any problem now > > public void connection(final *StateMachine sm* ){ > > ConnectionRequest r = new ConnectionRequest() { > protected void readResponse(InputStream input) throws IOException { > String sError = "This would be set by server"; > } > protected void postResponse() { > if (!sError.equals("error") >sm.back(); > } > }; > } > > On Monday, August 29, 2016 at 8:17:37 AM UTC+5:45, Peter Carlson wrote: >> >> ConnectionRequest does not have a constructor with StateMachine >> >> ConnectionRequest r = new ConnectionRequest(*StateMachine sm* ) >> >> ^^^ StateMachine cannot be resolved to a variable. >> >> >> There are no available imports for StateMachine. >> >> On 08/28/2016 06:39 PM, shyam tha wrote: >> >> Hi >> Hope the following code will help you so please check it >> ConnectionRequest r = new ConnectionRequest(*StateMachine sm* ) { >> protected void readResponse(InputStream input) throws IOException { >> String sError = "This would be set by server"; >> } >> protected void postResponse() { >> if (!sError.equals("error") >> * sm.back();* >> } >> }; >> >> On Monday, August 29, 2016 at 5:33:23 AM UTC+5:45, howud...@gmail.com >> wrote: >>> >>> Is there a way to programatically go back? Before in the old state >>> machine there was back(). Now with the newest framework, I cant find >>> back(). I'm not using the new GUI builder, I am coding all by hand >>> >>> ConnectionRequest r = new ConnectionRequest() { >>> protected void readResponse(InputStream input) throws IOException { >>> String sError = "This would be set by server"; >>> } >>> protected void postResponse() { >>> if (!sError.equals("error") >>>goBack(); >>> } >>> }; >>> >>> >>> >> -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/4e97be19-db06-4b2b-92e0-ca27db4bc077%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[codenameone-discussions] Re: programatically go back
Please check this and hope there will not be any problem now public void connection(final *StateMachine sm* ){ ConnectionRequest r = new ConnectionRequest() { protected void readResponse(InputStream input) throws IOException { String sError = "This would be set by server"; } protected void postResponse() { if (!sError.equals("error") sm.back(); } }; } On Monday, August 29, 2016 at 8:17:37 AM UTC+5:45, Peter Carlson wrote: > > ConnectionRequest does not have a constructor with StateMachine > > ConnectionRequest r = new ConnectionRequest(*StateMachine sm* ) > > ^^^ StateMachine cannot be resolved to a variable. > > > There are no available imports for StateMachine. > > On 08/28/2016 06:39 PM, shyam tha wrote: > > Hi > Hope the following code will help you so please check it > ConnectionRequest r = new ConnectionRequest(*StateMachine sm* ) { > protected void readResponse(InputStream input) throws IOException { > String sError = "This would be set by server"; > } > protected void postResponse() { > if (!sError.equals("error") > * sm.back();* > } > }; > > On Monday, August 29, 2016 at 5:33:23 AM UTC+5:45, howud...@gmail.com > wrote: >> >> Is there a way to programatically go back? Before in the old state >> machine there was back(). Now with the newest framework, I cant find >> back(). I'm not using the new GUI builder, I am coding all by hand >> >> ConnectionRequest r = new ConnectionRequest() { >> protected void readResponse(InputStream input) throws IOException { >> String sError = "This would be set by server"; >> } >> protected void postResponse() { >> if (!sError.equals("error") >>goBack(); >> } >> }; >> >> >> > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/d3ada50f-839c-441a-a5f3-d65de2a181dc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.