Change main form

11 views
Skip to first unread message

TiMIBoY Muff

unread,
Mar 18, 2020, 12:21:31 PM3/18/20
to CodenameOne Discussions
Hi there

How can i set/change the main form in the Statemachine?

Thanks for help!
Tim

Shai Almog

unread,
Mar 18, 2020, 11:57:53 PM3/18/20
to CodenameOne Discussions
Hi,
I would suggest avoiding the old GUI builder.
In it you can select the form you want as the main form and in the area of the properties if I remember correctly there should be a button to set it as main,
You can also edit codenameone_settings.properties which includes the name of the main form.

TiMIBoY Muff

unread,
Mar 19, 2020, 4:08:54 AM3/19/20
to CodenameOne Discussions
Thank you for your help! :)

I should have expressed myself more precisely.

I already set the main form with the button in the are of the properties.

But before the app starts, I want to decide which form should be displayed first,
depending on whether the user's login data is available or not.

I check whether the login data is available with existing or non-existent storage entries

Shai Almog

unread,
Mar 20, 2020, 12:45:50 AM3/20/20
to CodenameOne Discussions
In the post show of that form navigate to the actual form you want to show based on the state of the application.

TiMIBoY Muff

unread,
Mar 24, 2020, 11:25:09 AM3/24/20
to CodenameOne Discussions
Thank you very much! It worked! :)

But now when I start the app, you can see for a short time how the main form gets covered by the login form.

Is there maybe a way to change that? (without changing the TransitionOutanimator settings of the main form)

Shai Almog

unread,
Mar 24, 2020, 11:18:22 PM3/24/20
to CodenameOne Discussions
You can override    
public Form showForm(String resourceName, Command sourceCommand)

To do nothing if it shows the login page in that scenario. It's a bit of a hack but I'm afraid we don't have anything better for the old GUI builder anymore.

TiMIBoY Muff

unread,
Mar 25, 2020, 4:57:07 AM3/25/20
to CodenameOne Discussions
Nice! I set the in the override method TransitionOutanimator to setTransitionOutAnimator(CommonTransitions.createEmpty())

and now it looks good when i start the app.
Thank you very much.
Reply all
Reply to author
Forward
0 new messages