Hi,

Forgive my audacity, but this time my question is about logic.

I have two forms (classes) that interact with each other. The main one has 
a set of containers that in each item has a status label (starts pending) 
and a "multibutton" component that triggers the second form.
Depending on what you do in the second form the status of the item in the 
first form should change (for example to completed).

In the main form create a public method that is in charge of changing the 
status of the item.


When I fire the second form, I include in the constructor the object that 
represents the first form and in this way I can execute the public method 
as I please.

*public class mainForm extends Form {*

   private container cnItem = new Container();

   public mainForm() {

      MultiButton mbMyButton;
      mbMyButton.addActionListener ((e) -> {
          setItemSelect(cn);
          new secondForm (this, md) .show ();
      }
  }
  
   *public void changeStatus () {*
*      changeItemStatus(getItemSelect());*
*   }*

   private Container getItemSelect() {
       return cnItem;


   private void setItemSelect(Container cn) {
       cnItem = cn;
   }

}

*public class secondForm extends Form {*

   public secondForm (MainForm mf, ModelDato md) {
      if (md.condition) {
         mf.changeStatus ();
      }
}

This works for me, but I have always thought that there must be a more 
orderly way. 

I thank you if you can point me to a better form of logic.

Thanks.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/3530c3b8-98a1-42c0-a65c-974c24c96aa6o%40googlegroups.com.

Reply via email to