2023 R2: Workaround for the ShowContent() symbols not disappearing on context change anymore

Hi all,

We're currently testing the new System Platform 2023 R2, and found out symbols that have been displayed with a ShowContent() do not disappear anymore when the context changes. Support confirmed to us that this is on purpose and not a bug, even if I'm struggling to understand the point...

The way we've designed our layout, symbols like motor controls are displayed on operator actions with a ShowContent and it doesnt make sense to keep them open when the context changes.
Our idea for a workaround was to have a layout script executed on every context change, that basically goes that way for every pane we want to clear:

dim contentInfo as aaContent.ContentInfo;
contentInfo.PaneName = "NameOfThePane";
contentInfo.ContentType = "App_Device_Faceplate";
HideContent(contentInfo);

The contentType is used to avoid wiping the auto-fill content when the script runs after the autofill has already happened, as only the ShowContent() symboles are using the App_Device_Faceplate content type.

The current issue with this basic script is that it runs without checking if there is matching content in the pane, generating logs when there isnt.

Would anyone have ideas on how to improve that script, or a whole different solution we didnt think of ?
I doubt we'll be the only ones struggling with that new feature, as we've seen others use the same mechanism.

Thanks

Parents
  • Hello Quentin, 
    My immediate ideas

    1) Maintain the list of content names and their panes (which can be challenge with Autofill algorithms)
    2) Would be to add a custom property to symbols being display by ShowContent  (e.g. HideOnContextChange with default false) 
    Then on the same symbol have a datachange script something like that:

    Expression: MyViewApp.Navigation.Current
    Body:

    if HideOnContextChange then
    HideSelf();
    endif;

    Now where you use the ShowContent() you can pass a custom property value to it (below is the additional lines to add 

    Dim cpValues [1] as aaContent.PropertyOverrideValue;
    cpValues[1] = new aaContent.PropertyOverrideValue("HideOnContextChange", "True", true);
    contentInfo.PropertyOverrideValues = cpValues;

    The complete example you can see in the online help for ShowContent()

  • Thanks a lot, we'll look into that second idea, seems like a reliable way of doing it

Reply Children
No Data