Options

Searching Add-in Example

mikmik Member Posts: 79
edited 2012-02-10 in NAV Three Tier
Hi,
I try to build a simple Add-in like http://www.excellent.se/en/solutions/add-ons/drag-and-drop.html.

I found some add-in examples and those are working fine. My problem is. I have no idea how i can build an add-in where I have a panel/picturebox or something like that which looks like the example in the link above.
Can someone show me an example how I can do this.
The second question is how should my factbox look like? On which element will I have to link my add-in?

I am only searching for examples.
No textbox examples on a Card Page where I have to override an other control. I tried those examples and everything worked fine.

I hope someone already did "the trick" :)

greetings mik

With kind regards
mik

Comments

  • Options
    TroelshTroelsh Member, Microsoft Employee Posts: 79

    Troels Bent Hansen
    Senior Program Manager
    Microsoft Dynamics NAV


    ****** This posting is provided "AS IS" with no warranties, and confers no rights ******
  • Options
    deV.chdeV.ch Member Posts: 543
    If you managed to do the examples you should know how you can do something like this ;)

    You just need to return the Object you would like to display in the CreateControl() method.

    Like i always return a panel, call it main_Panel or whatever you like, then i add the controls i need to this panel.
    But my base is always such a panel.

    Here's a simple example of a Panel with a label in it:
    public class C_TitleAddin : StringControlAddInBase
        {
            private Panel m_Panel;
            private Label m_Label;
            protected override Control CreateControl()
            {
                m_Panel = new Panel();
                m_Label = new Label();
                m_Panel.Controls.Add(m_Label);
    
                // Label Properties
                m_Label.Dock = DockStyle.Top;
                m_Panel.Padding = new Padding(0, 15, 0, 5);
                m_Label.Font = new Font(m_Label.Font, FontStyle.Bold);
    
                // Panel Properties
                m_Panel.BackColor = Color.White;
                m_Panel.MinimumSize = new Size(300, 35);
                m_Panel.MaximumSize = new Size(750, 35);
    
                return m_Panel;
            }
    
            public override string Value
            {
                get
                {
                    return string.Empty;
                }
                set
                {
                    m_Label.Text = value;
                }
            }
        }
    

    Of course you're addin need more logic, you need to call the on addin event, when droping, you need to handle the drop event, pass the droped data (base64?), etc etc.
  • Options
    mikmik Member Posts: 79
    Hi,

    thx Dev.ch. I already built the application als windows form project.
    Everything I want works fine. I wasn't able to implement the same as client add-in.

    I will try your solution.

    Thanks

    With kind regards
    mik
Sign In or Register to comment.