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.

Reply via email to