0
votes

I tried a simple project with 2 forms: Login and MainMenu

I made GUI with Codename One design:

enter image description here

I checked in StateMachineBase class, I think it for LoginForm (the first form)

enter image description here

And now, I want to click on Login button it will open MainMenuForm, but I don't know how to do. Can you help me, maybe some tutorial or simple sample.

1

1 Answers

1
votes

You can look at this: http://www.codenameone.com/how-do-i---handle-eventsnavigation-in-the-gui-builder--populate-the-form-from-code.html it covers pretty much everything.

The state machine base shouldn't be modified. Just select the login button and do one of two things:

Click the Action Event button and then when you are sent to the Statemachine class where the callback method would be added you can just use code like:

showForm("MainMenuForm", null);

Alternatively you can select the Command property of the login button and select that it would be a navigation command that will lead you to the main menu form. This is done entirely in the GUI builder with no code required.