Dialogs have a useful method that returns a Command,  showDialog(). By that 
I was able to avoid things like what you are saying, and I can also return 
parameters inside the command with the setProperty() method. No runnables 
needed and the code is readable.
Dialogs have issues in certain cases, unfortunately. Someone advices to use 
the InteractionDialog class, that is bad IMHO because of the necessary 
handling of the mouse events and the back command.

But I was said that Dialogs are just like Forms.

So you could ask them to create a method similar to showDialog(),
like 
public Command showBackWithCommand()
{}

Regards
Il giorno martedì 22 dicembre 2020 alle 04:26:32 UTC+1 [email protected] ha 
scritto:

> 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/7cd3e130-f8f2-4025-abba-303e768ee96dn%40googlegroups.com.

Reply via email to