Use content of a textField

4 messages - 1437 views

Hello, I'd found your UI-Framework a few days ago.
But now I've some problems. - Creating an UI isn't hard,
but how can I read Inputs of the controles like textfields?

Sorry about the bad english, I'm from germany.

option 1:

in the xml file:

             <!--    using attribute "id" to select a widget -->

                      <textfield id="tf1"></textfield>

                      <button onaction="act(#tf1.text)"></button>                       <!--  the textfield's content will be used as an argument to the action "act"  -->

option 2:

           in  Frame's method

                  public onMessage(String identifer,Object[]arguments){

                                  Widget wig=FrameFocus.getWidget("tf1");             //get the widget by hand

}

Hi yanggym,

I have tried to read the contents of a field inside the Frame Method and I have not managed. I have used your method but in vain. Could you please explain futher how you read the contents of a field from inside a method?

My app requires login so user has to type username and password. I want a way to get the contents of the username and password field.

Thanks.

<popupBox style="align:fill;layout:inlinelayout(false,fill)">

%USERNAME% <textfield id="name" tooltip="Enter username"/>

%PASSWORD% <textfield id="pass" tooltip="Enter password" constraints="password"></textfield>

<popupBoxFirstMenuItem onAction="oklogin(#name.text, #pass.text)">%OK%</popupBoxFirstMenuItem>

<popupBoxSecondMenuItem>%CANCEL%</popupBoxSecondMenuItem>

</popupBox>

 

This line: <popupBoxFirstMenuItem onAction="oklogin(#name.text, #pass.text)">%OK%</popupBoxFirstMenuItem> picks up the form arguments and then sends them over to the onMessage for processing.

 

nii amon