110 views
in GUI Development by
Hi,

 

If I have my root screen(Screen1) and instead of navigation from Screen1,i want to show the splashscreen once at powerup .If I trigger splashscreen from system event .It does not navigate directly to splashscreen. Even if i add the code in system event as   

var Application::SplashScreen SplashScreen = new Application::SplashScreen;
var Core::Root rootObject = GetRoot();
rootObject.Add( SplashScreen, 0 );
rootObject.BeginModal( SplashScreen );

1 Answer

0 votes
by

Hello Pidea,

the code looks correct so far. Are you sure it is executed? You can try to set a breakpoint in this code. Or add the trace statement to log the execution.

I hope it helps you further.

Best regards

Paul Banach

by
If i try to debug it is stuck on this statement rootObject.Add( SplashScreen, 0 );

rootobject = null  showing on variable window
by

Hello Pidea,

Then we are one step closer to the goal. The question now, why returns GetRoot() the value null? Please see the section Access the root object. I suppose, the GUI component in context of which you invoke GetRoot() is not part of the view tree.

Best regards

Paul Banach

by
Hi paul,

I also observed it is not a part of view tree .

So how to add the context in View Tree. So that i can trigger particular GUI component from system Event
by

Hello Pidea,

if the component does not belong to the view tree you have three options:

Option 1: If you are using a System Event Handler, you can add the handler directly to a GUI component which is surely part of view tree. This is for example the Application component. Then when the handler is notified, the associated implementation can access GetRoot().

Option 2: You can pass on the root object to the affected component and store it there within e.g. a variable. Then you use this variable instead of GetRoot(). This expects, however, that at the time when the variable is initialized, you can successfully access the root object via GetRoot() of some other GUI component or via other already initialized variable.

Option 3: Ensure that the component belongs to the view tree. This can be done, for example, by invoking the method Add() of the Application component. See also Compose the component programmatically.

Does it help you further?

Best regards

Paul Banach

by

hi paul,

 

thanks for the reply ,

 

I have already implemented the first approach and when debug i could see that it notifies the system event handler in that GUI component but the screen is not visible instead root screen is visible

https://ask.embedded-wizard.de/?qa=blob&qa_blobid=11490570932845664495

by

Hello Pidea,

so far I could see, your project will not work. Following implementations need a rework, since they don't make sense actually:

1.) DismissDialog() with a new instance of some component as parameter. DismissDialog() is intended to dismiss a previously presented dialog. The following will not work:

2.) The System Event Handler is found in the component SplashScreen. The instance of this component, however, does not belong to the view tree. Its Owner is null:

This is the case, because the SplashScreen component is instantiated in the above (item 1) operation. There, you invoke DismissDialog() with new Application::SplashScreen as operand.  This creates a new instance of the SplashScreen component. Since the instance is not used elsewhere in the application, it will be disposed by the next garbage collection. In the meantime, the system event handler found in the instance can receive events. And it receives an event. Another instances seems to be instantiated in the onKeyRelease method:

3.) The SplashScreen component tries to create a new instance of itself and present it within its own scope. This occurs when the System Event Handler in SplashScreen is triggered:

Since the actual instance (item 2 above) is not belonging to view tree, the effect of this operation is not visible.

Well, what can do? First rework the code to clean the above items 1-3. Then, move the System Event Handler and its associated slot method to the Application::Application component. I did following for example. Now the SplashScreen appears when the system event is triggered:

So far the solution for this issue. I hope it helps you really further. It seems you are struggling with many very basic problems ....

Best regards

Paul Banach

by
thanks paul,

It seems you are struggling with many very basic problems ..

Yes i am new to this software and already started the project .I have seen some video and read some documentation thats it.

I hope you understand and thanks for the reply
by
Hello Pidea,

yes, I understand it. GUI development is in fact a complex task. If desired, we offer our customers dedicated workshops. During such workshop the users learn not only how to use Embedded Wizard but also how to structure their particular GUI application and how to integrate it with the target system. This can be a useful complement to the existing documentation.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...