The Attribute pop-up editor allows you to display a custom attribute editor when the user clicks the edit button in the existing attribute-editor.


Prerequisites


In your extension, create a class that implements the IswAttributePopupEditor interface and implement your own code based on this example. When the extension is enabled in the client, your custom attribute editor will show up.


Example

using System.ComponentModel;
using RemObjects.Hydra;
using SystemWeaver.ExtensionsAPI;

namespace SWExtension.Examples
{
    [Plugin, NonVisualPlugin]
    public partial class AttributePopupEditorExample : NonVisualPlugin, IswAttributePopupEditor
    {
        IswHost _host;

        public AttributePopupEditorExample()
        {
            InitializeComponent();
        }

        public AttributePopupEditorExample(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
        public string GetAttributeTypeSID()
        {
            return "ATTR";
        }

        public string GetDisplayString(IswAttribute attribute)
        {
            if (attribute.ValueData != null)
            {
                return "Calculate display value here";
            }
            else
            {
                return "";
            }
        }
        public bool EditAttribute(IswObj obj)
        {
            // Put your code launching the custom attribute-editor here.
            // Remember that an attribute of given type may or may not already exist on the obj,
            // and the current user may or may not have write access to the obj.
            System.Windows.Forms.MessageBox.Show("Editing attribute on obj: " + obj.Name);
            return false;
        }

        public void SetHost(IswHost host)
        {
            _host = host;
        }
    }
}