Hi,
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