Options

Client Addin: Set control invisible if editable in RTC chang

gob_Behnkegob_Behnke Member Posts: 14
edited 2010-10-15 in NAV Three Tier
Client Addin: Set control invisible if editable in RTC changed

Hi,

I guess I have a quite easy question, but I can't get it to work on my own.

I have a very basic Client Addin:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Dynamics.Framework.UI.Extensibility;
using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
using System.Drawing;

namespace GOBInvisibleFields
{
    [ControlAddInExport("GOB.NAV.InvisibleFields")]
    public class MyFieldPopupAddin : StringControlAddInBase, IControlAddInSite
    {
        protected override Control CreateControl()
        {
            TextBox control = new TextBox();

            control.MinimumSize = new Size(50, 0);
            control.MaximumSize = new Size(300, Int32.MaxValue);

            control.BackColor = Color.LightBlue;
            control.Font = new Font("Tahoma", 9, FontStyle.Bold);
            
            return control;
        }
    }    
}

It's based on the example in the NAV help and I just want to add one functionality.
If the field's (the field the addin is bound to) editable property changes to false, the control should get invisble.
Vice versa, if the editable property is changed to true, it should reappear.

I guess I can achieve this via the interface "IControlAddInSite", but I can't get it up and running.

Any help is greatly appreciated.

Kind regards
Michael

Answers

  • Options
    deV.chdeV.ch Member Posts: 543
    protected override void OnEditableChanged(bool editable)
            {         
                control.Visible = editable;
            }
    

    Ofcorse you need to declare your textbox out of the CreateControl() Method, otherwise you cant access the Control

    And by the way: if you type "protected override" the intellisense shows you all virtual methods that you can grab to fill with your code...
  • Options
    gob_Behnkegob_Behnke Member Posts: 14
    Thanks,

    now it works.
Sign In or Register to comment.