View already in a group -> PANIC: System halted

asked Jul 10, 2018 in GUI Development by itPenguin

For switching between different views I use Remove/Add. Obviously, when a view is added again, this results in a Panic:

View already in a group
PANIC: System halted

So I tried to remove the view, before adding again, but the panic will be the same:

if (this.FindViewAtPosition( DeviceLT.G_HauptansichtEinstellungen, <20,144>, Core::ViewState[ Visible, Enabled] ) != null)
    this.Remove( DeviceLT.G_HauptansichtEinstellungen );
this.Add( DeviceLT.G_HauptansichtEinstellungen, 0 );

I assume, the navigation between the pages will be much easier, when I switch to EW 9.0 and dialogs?

1 Answer

0 votes
answered Jul 10, 2018 by Paul Banach


If the view already belongs to a group, it does not make much sense to add it again. Similarly, if a view has been removed, it can't be removed again. The reported error messages exist exactly to indicate such programming errors. The unique reasonable exception is if you want to  change the owner of the view. In such case you first remove the view from its actual owner and then you add the view to the new owner.

Please note, you use the method FindViewAtPosition() in context of this but then you remove a view from a foreign group DeviceLT. The method FindViewAtPosition() searches fro the views within the group in context of which it has been invoked only. The if-condition is thus incorrect.

Please see also the thread: Calling Root.EndModal(Screen); causes a crash with message "The group is not modal" in rare cases. Maybe it is also your case.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint