codenameone - How to use variables to refer to Components in codename one? -


i created ui uibuilder.

instead of using findxxxx (), love in statemachine:

public class statemachine ... {  private container c; private tabs t;   initvars () {    initall(); }  .... private initall () {    container c = findcontainer();    tabs t = findtabs();    ... } 

}

and use them c.getyyy().

is possible? if yes, how?

yes can that, not advisable.

the danger of when have 2 components same name on different forms, may reference wrong component , may hard debug.

if sure can deal above, can declare , initiate variables inside statemachine class outside of methods private global variable.

public class statemachine ... {      private container c = findcontainer();     private tabs t = findtabs();       initvars () {      }      .... } 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -