Some cases of requirement, I need to have text editor in Navision that does not limited to 1K of string and I need able to have break line and simple decoration. This large text could be for explanation of production description, shipping handling or document requirement or could be some comment.  So I try to develop a new stuff in Nav 2009 sp1 features call control Addin an as usual using Visual Studio Express Edition 2010 to create one.

 

I have only simple objective which able to write text freely using RichTextBox .net control and store in into Blob field as expected. There are little troublesome I found that I could not use enter in the Richtextbox control under the RTC Page. It is not good to have rich text box without ability to create a break line certainly. So eventually I end up displaying button on the RTC page and when user click the button, it will pop up a modal window with Richtextbox. Here below the overall pictures.

Overall Control Text Editor Addin

To make this blog article short, I will directly to the important point in development while the detail and the source code project is attached in this article. So please try it and use it freely. The important points in this development as follow:

  1. Add reference to Microsoft.Dynamics.Framework.UI.Extensibility.dll which you can found it in RTC installed folder.
  2. Don’t forget to use class attribute ControlAddInExport to give a name for your control addin name when you call it from RTC page. I call it “NavEditorAddin”.
  3. My control add in class will inherit from WinFormsControlAddinBase and importantly also implement interface IValueControlAddInDefinition. This interface gives me the only possibility to have two ways of data binding which mean Display and Update back the changes to database.
  4. Create a strong name key file and sign the assembly in visual studio project property.
  5. Compile the project and copy the generated Dll into .. \RoleTailored Client\Add-ins folder where the RTC will need it.
  6. Make the dll register in global assembly. You can do drag and drop into assembly folder in C:\Windows\assembly or using command line GACUTIL –I <the assembly file>. Note GACUTIL is .net framework utility tools.
  7. Once successful registered, you can find the public key token in the assembly folder itself. Find your class assembly there and right columns on the side display a key.
  8. On the classic client, you need to register the control add in by entering a new line into a virtual table 2000000069 Client Add-in

 Entering New Addin control

In the page where you want to use the text editor you will need to change following property. Please note, I am using a BLOB field as my SourceExpr.

Navision page line property 

Here is the project source code and enjoy!

Source Project Files 

Cheers!

9 Responses to “RTC Text Editor Control Addin for Nav 2009”

  1. Sarah Says:

    I have just read your blog from start to finish!

    http://mibuso.com/blogs/mandyk/

    You are sharing all this knowledge/efforts and work globally!
    This is amazing!
    One of the top 5 blogs on Dynamics NAV out there!

    It really helped us move forward , thanks!

  2. Esther Says:

    This site is like a classroom, ecxept I don’t hate it. lol

  3. Alex Says:

    This AddIn is quite nice. But if you change/input a value into the BLOB and afterwards Trigger an OnValidate-event of another field in this table, the changes/input in the BLOB is gone.

    Is there a fix for this?

  4. Sascha Says:

    Hello,

    very good! One question: As you described it, you need to invoke the text editor by clicking “Show Editor”. Is it possible to always show the Editor inside the Fast Tab named “TextNoteArea”

  5. anton Says:

    Hi,

    I actually need the simple thing you mentioned, a text area in the page itself, no rich text, no line feeds, just text area taking more than 256 characters, like notes. I can\’t use notes because I need several such fields on the same object. Would you still have a copy of your early tests with the simple textarea by any chance?

  6. mandyk Says:

    Hi Anton,
    I already put the link “Project Source Files” in this article and you can download it. As suggestion, try to use computer browser to open this article. Thanks

  7. baptiste Says:

    Hi,

    I have the same problem that Alex. When i close the editor and switch to an other record the text is not saved. In fact a try many manipulation and I can’t save the text. Have I to add something in the C/AL code ?
    Or may be it’s not compatible with Nav 2013 ?

  8. manfred Says:

    Hello,

    many thanks for sharing this !

    one question about Encoding:
    i’ve the issue of some Special german characters (öäü e.g.)
    i tested Encoding with utf8, Unicode, ansi, 850, 437 …, but i didn’t get the correct chars with reading the BLOB in NAV

    do you have any idea about this ?

    b.r.

  9. mandyk Says:

    To Alex, Baptiste.
    You can try to add currpage.update(true) or currpage.saverecord in onvalidate trigger event of the ControlAddIn. This is not a perfect way but at least the changes in the text memo is not gone away.

    To Manfred:
    Nav 2009 software framework is not fully unicode compatible and it is rely on the operating system code page or SQL code page. So at the time when the blob is read into text /bigtext variable, the content is already translated into the active code page, but not with Instream / Outstream variable type. Right after the content is in instream, you use the dotnet variable or dotnet framework class to manipulate the content. Hope you have good luck!

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word