Question

I am trying to quickly create a mock up app using CODENAME ONE

I am finding the resource editor difficult to understand.

1) I create a form and place a button on it.

2) I created another form with the message "Hellow World"

3) I add an action event to the button on FORM 1 using the resource editor and netbeans opens up with a method implementing that action.

4)Now I wish to write in that method some code to display form2 ("Hello World") . How do i do this?

Q1) How do i refer the object of form2 in this case?

Q2)Also, on the display of form2 , I wish to add a textbox on it. how do i do this using resource editor?

My basic question is how can we reference elements created by resource editor via CODE?

Était-ce utile?

La solution

The simplest thing is to set the button as a Command and just select the destination form in the action (notice this will effectively disable the action event).

Alternatively you can call: showForm("formName", null); from code.

To add elements to an existing form you need to decide where they should be. E.g. the destination form has a Container where you want to place the TextArea?

Just name that Container in the GUI builder as "MyDestContainer". Now when you want to add the text area you can get a pointer to the Container by using something like:

 Container dest = findMyDestContainer(Display.getInstance().getCurrent());

Autres conseils

you can do for this wave

enter image description here

showForm("Ingreso_Recibo", null);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top