Dynamic Home Screen

What do you want to achieve?

I want to dynamically designate which screen to load first, probably via the Initial Actions function.

The first screen in the SquareLine UI has a “home” icon and is the one that gets loaded in the ui_init(void) method. I would want there to be no home screen and/or no loaded screen by default in the init method.

Use Case: I want to show a diagnostics screen on the first run of the app, but show a dashboard screen on subsequent runs.

What have you tried so far?

I tried loading different screens from the home screen’s LoadStart or Loaded events but I get a crash error when I do that.

Others

  • **SquareLine Studio version: 1.3.4
  • **Operating system: Windows
  • **Target hardware: ESP32

Why you dont use blank screen as home …?

I would try that but it seems like jumping from a screen to another in the loading events causes a crash.

EDIT: Made a blank startup screen and confirmed this causes an unhandled exception:

void StartupScreenLoadStart(lv_event_t *e)
{
	// on first run, switch to diagnostics
	bool isFirstRun = g_settings.getFirstRun();
	if (isFirstRun)
		lv_scr_load(ui_DiagnosticsScreen);
	else
		lv_scr_load(ui_SplashScreen);
}

EDIT2: Loaded event may work… testing now

Okay I confirmed this technique works using the Screen Loaded event. Thanks!