문제

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?

도움이 되었습니까?

해결책

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());

다른 팁

you can do for this wave

enter image description here

showForm("Ingreso_Recibo", null);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top