Showing results 1 to 2 of 2

Thread: Changing linked property of a inserted symbol c#

  1. #1
    Join Date
    13.11.2017
    Posts
    1

    Default Changing linked property of a inserted symbol c#

    Hi,

    So I'm currently working on a project for auto generated variable, screens etc. and I'm able to insert a symbol into the screen specified with my add-in, but I can't seem to find the correct way to change my linked property for a button.

    Example:

    Click image for larger version

Name:	support1.png
Views:	6
Size:	10.8 KB
ID:	3227

    Click image for larger version

Name:	support2.png
Views:	3
Size:	19.5 KB
ID:	3228

    My code:

    var navSymbolBtn = myScreenRenamed.ScreenElementCollection.Create("Tile_" + symbolName, Scada.AddIn.Contracts.ScreenElement.ElementType.Sy mbol);
    navSymbolBtn.SetDynamicProperty("LinkName", "Tile");
    navSymbolBtn.SetDynamicProperty("GraphicSize", "0");
    navSymbolBtn.SetDynamicProperty("SubstituteSource", "*xxxx_Mxx*");
    navSymbolBtn.SetDynamicProperty("SubstituteDestination", symbolName);
    navSymbolBtn.SetDynamicProperty("ExpProps[8].ExpPropValue.Function", "screenSwitch_M01");
    navSymbolBtn.Top = 0;
    navSymbolBtn.Left = 10;

    Everything works except for "navSymbolBtn.SetDynamicProperty("ExpProps[8].ExpPropValue.Function", "screenSwitch_M01");". And yes the function exists beforehand.

    Can anyone guide me in the right direction?

    Thanks

    Br

    Thomas

  2. #2
    Join Date
    10.12.2007
    Posts
    280

    Default AW: Changing linked property of a inserted symbol c#

    I did some tests, and it seems that linking objects isn't easy. But I found out how to link simple values, for example Text-Property of a StaticText element (asuming ExpProps[0] is the Text Property of a Static Text Element in the symbol):

    navSymbolBtn.SetDynamicProperty("ExpProps[0].ExpPropValue", "Hello World");
    (Ups, didn't recognize the missing xml-Tag Text in brackets <> here)
    don' forget afterwards:

    navSymbolBtn.Update();
    and save the picture:
    navSymbolBtn.Parent.Parent.Save();

    But... the string for a function seems to be rather more complicated....

    Maybe it helps you
    EDIT:
    Ok, now i'm curious. Additional testing shows this might work:

    Code:
    navSymbolBtn.SetDynamicProperty("ExpProps[8].ExpPropValue", "screenSwitch_M01");
    F... I can't get the right code here in the forum. It always deletes the surrounding tags
    You have to enclose the Name of the function with the xml-Tags Function and Name in these <> brackets.
    Last edited by mst : 31st March 2022 at 16:04 Reason: Got it finally...

Similar Threads

  1. Warnings in output for no variable linked and no function linked
    By Saad_Bin_Saeed in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 1st April 2021, 12:02
  2. Warnings in output for no variable linked and no function linked
    By Saad_Bin_Saeed in forum zenon Energy Edition
    Replies: 1
    Last Post: 1st April 2021, 12:02
  3. XAML property
    By banpr1 in forum VSTA
    Replies: 8
    Last Post: 21st November 2019, 03:11
  4. How to access linked symbol sub elements
    By carlo.chiari in forum VBA
    Replies: 6
    Last Post: 1st October 2012, 14:03
  5. Changing Iamge BackgroundImage property
    By davide.galigani in forum VBA
    Replies: 1
    Last Post: 1st June 2010, 01:13

Tags for this Thread

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •