title: codenameone reference components from another function
body: <p>I have created a register form (not using the designer).</p>
  
  <p>On the form I have created numerous text fields as well as a button with ...</p>
  
  <pre><code>    Button btnRegister = new Button();
      btnRegister.setName("btnRegister");
      btnRegister.setText("Register");
      btnRegister.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
              frmRegister_btnRegister(f);
          }
      });
      f.addComponent(btnRegister);    
  </code></pre>
  
  <p>My question is how do I reference the textfields in the function being called from the button action listener. Specifically I am trying to set up arguments to use for a network call using addArgument. When I used the designer I used find(ComponentName) but that is not available anymore.</p>
  
  <pre><code>private void frmRegister_btnRegister(Form f) {
      // register new user
      ConnectionRequest r = new ConnectionRequest(); 
      r.setUrl(sUrlWebSvc);
      r.setPost(true);
  
      r.addArgument("Rest", "1");          // restaurant code
      r.addArgument("Req", "Register");    // R = register
  
  
      //r.addArgument("first_name", findTxtUsertName(c).getText());
  
      // show spinning dialog while connecting
      InfiniteProgress prog = new InfiniteProgress();
      Dialog dlg = prog.showInifiniteBlocking();
      r.setDisposeOnCompletion(dlg);
      NetworkManager.getInstance().addToQueueAndWait(r);
      //System.out.println(r.getResponseData());      
  }
  </code></pre>