Showing results 1 to 3 of 3

Thread: FillColor screen element

  1. #1

    Frage FillColor screen element

    Hi, I made some code:

    using Scada.AddIn.Contracts;
    using Scada.AddIn.Contracts.ScreenElement;
    using Scada.AddIn.Contracts.Screen;
    using System;
    namespace wizardHighlightSelectedRow
    {
        ///
        /// Highlights Selected element on the screen
        ///
        [AddInExtension("wizardHighlightSelectedRow", "Your Project Wizard Extension Description")]
        public class wizardHighlightSelectedRow : IProjectWizardExtension
        {
            #region IProjectWizardExtension implementation
            public void Run(IProject context, IBehavior behavior)
            {
                IScreenCollection screens = context.ScreenCollection;
                string selectedScreenName = null;
                IScreenElementCollection controlElements = null;
                foreach (var item in screens)
                {
                    if(item.Name == "Main")
                        controlElements = item.ScreenElementCollection;
                }
                foreach (var item in controlElements)
                    if (item.Name == "Button_2")
                    {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                    else if (item.Name == "Dynamic text_3") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                    else if (item.Name == "Button_9_1_1_5") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }                
                    else if (item.Name == "Element group_1") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }                
                    else if (item.Name == "Dynamic text_1") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                }
            }
            #endregion
    }

    1. And, what method to initialize collor is more correct? This one item.SetDynamicProperty("FillColor", 0xE74C3C); is not working. I suppose, propertyPath is not correct.
    2. Can I hold color filled, till variable will hold value X? Cos, when I navigate to other project, and then return to FillColor screen, then element of that screen wil have default color, not that one what I set. I suppose it will be the same when I will navigate to other screen in same project.
    3. How to get the same color as in the pallet at https://htmlcolorcodes.com/ in uint (FillColor type). Cos when I use hex as variable, it fill element by different colour. For example, 0x99CA3C is not the same as I have in default pallet in Zenon Superviser etc.



  2. #2

    Default Re: FillColor screen element

    frw.

    Quote Originally Posted by Oleksandr View Post

    Code:
    using Scada.AddIn.Contracts;
    using Scada.AddIn.Contracts.ScreenElement;
    using Scada.AddIn.Contracts.Screen;
    using System;
    namespace wizardHighlightSelectedRow
    {
        /// <summary>
        /// Description of Project Wizard Extension.
        /// </summary>
        [AddInExtension("wizardHighlightSelectedRow", "Your Project Wizard Extension Description")]
        public class wizardHighlightSelectedRow : IProjectWizardExtension
        {
            #region IProjectWizardExtension implementation
            public void Run(IProject context, IBehavior behavior)
            {
                IScreenCollection screens = context.ScreenCollection;
                string selectedScreenName = null;
                IScreenElementCollection controlElements = null;
                foreach (var item in screens)
                {
                    if(item.Name == "Main")
                        controlElements = item.ScreenElementCollection;
                }
                foreach (var item in controlElements)
                    if (item.Name == "Button_2")
                    {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                    else if (item.Name == "Dynamic text_3") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                    else if (item.Name == "Button_9_1_1_5") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }                
                    else if (item.Name == "Element group_1") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }                
                    else if (item.Name == "Dynamic text_1") {
                        item.SetDynamicProperty("FillColor", 0xE74C3C);
                        item.Update();
                        item.FillColor = 0x99CA3C;
                        item.Update();
                    }
                
                }
            }
            #endregion
    }


  3. #3

    Frage Re: FillColor screen element

    Quote Originally Posted by Oleksandr View Post
    Hi, I made some code:

    4. How to FillColour group of elements on the screen? item.Name == "Element group_1"

Similar Threads

  1. Screen title in header screen
    By yolovs in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 10
    Last Post: 20th September 2019, 12:24
  2. Replies: 1
    Last Post: 9th March 2017, 08:58
  3. RTSP Video Screen type or HTML Screen type
    By veiga144 in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 23rd June 2016, 10:48
  4. Close one screen, opens other screen
    By dario in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 3
    Last Post: 14th November 2012, 10:34
  5. Replies: 5
    Last Post: 5th October 2012, 07:34

Posting Rules

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