Unable to begin a new modal dialog from another modal dialog's UpdateViewState() method

asked Sep 17, 2017 in GUI Development by xaviesh
Hello, I've been struggling with this issue for a long time. I have a use case where I have a root screen and then an Idle modal dialog on top of it that exists throughout the execution of our application. I use this Idle screen as the base dialog to which I remove all dialogs to and then launch another modal dialog from the UpdateViewState() method when it comes back in focus and when different conditions become applicable. But, it looks like I always get a "PANIC: System Halted" message on the target device or an "Endless Signal Delivery" message as follows. Could you tell me where would be a good place to launch a new dialog from if not from the UpdateViewState() function. I've tried adding an observer slot to this Idle screen for that condition in the Init() function but that causes a "PANIC: System Halted" message on the target device also. Please note that when I say Init() and UpdateViewState(), they're all overridden functions. Thanks!

1 Answer

+1 vote
answered Sep 17, 2017 by Paul Banach
Best answer


the method UpdateViewState() is called when the state of the component changes or the method InvalidateViewState() has been called previously. UpdateViewState() however is not called immediately. When the state of the component changes or the method InvalidateViewState() has been called, a postsignal statement is used to record the event and execute UpdateViewState() after a short delay. In this manner several state alternations or several InvalidateViewState() invocations are acumulated and result in a single UpdateViewState() invocation.

The postsignal statement, in turn, verifies whether the signal to post is actually in execution. In other words, does one slot method try to postsignal to itself, the postsignal statement detects it, discards the signal and reports a warning. This is essential to avoid endless delivery of signals.

So far the theory. Now, in your case you call BeginModsal() from UpdateViewState() method. If the original component was focused or modal, this operation will cause this component to lose this state before the new component can become active. In other words, the state of the original component changes. As described above, this collects a postsignal to invoke UpdateViewState() again. Since the UpdateViewState() is actually executed, the  postsignal detects possible endless recursion in signal delivery and reports the warning.

The mentioned panic message may occur when you call BeginModal() twice for one and the same component. In such case the system will report, that the component is already modal. Since UpdateViewState() can be executed multiple time in the lifetime of a component, the implemented BeginModal() can be invoked several time resulting in the panic.

Well, the best would be not to change the state of the component when executing UpdateViewState(). The method UpdateViewState() is intended to handle the situation after the state has been changed. For example, to update views existing in the component so they reflect the new state.

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