NAV 2009 custom addin controls
Comments
-
This is really a step forward!Cool!
RTC it's getting better and better...but it looks like I have to learn some C#...
btw...nav is moving in this direction... :roll:
*edit: i wonder if we will be able to implement something like an OnMousePos trigger...i have to read the post more carfully and wait for the real product to come out0 -
You can fire one predefined event from the control with two parameters: one Integer and one String. There is trigger in NAV for this event. It means you can use this trigger as generic event of the control and use the integer to select what you want to fire in NAV etc.
In some future versions there will be (may be) event support for the control (each event will have trigger in NAV), but not now...0 -
As I said, I have to read the blog more carefully (i couldn't understand your post, kine...), but what I meant (i didn't explained it because i was a bit in a hurry) was: implement some add-in that has an onmousepos, and then run C/al from that trigger (webservices, maybe?).
Maybe i wrote some ridicolous things :oops: (i don't know C# and object oriented programming), i'll correct my post after investigating some more. Thanks for now0 -
That's ok. What I wanted to wrote is, that in SP1 there is new trigger which can be fired from within the addin. This trigger you can fire on event in the addin you want (e.g. for OnMousePos). You can pass two parameters to this trigger - integer and text. It means you can use the same trigger in NAV for different events in addin and through index tell NAV which event it was etc... I hope that now it is more clear. Do not worry, all this is new for everyone and we all will need to learn something... 8)0
-
Ok, more clear now: the "code flow" will then be something like:
- An event triggers when using addin (to be simple: push a button in a winform)
- The addin trigger calls the predefined C/al trigger passing a "developer-defined" ID in order to let nav know what add-in event is triggered(integer or text)
- The C/al trigger execute some code
But...can data be retrieved and or send to the add-in control? (maybe future blog posts will explain this... :-k )0 -
Yes you can bind the data of the control to an AL Text or BigText variable and have it handled as a C# String or Object type in the control.Dean McCrae - Senior Software Developer, NAV Server & Tools
This posting is provided "AS IS" with no warranties, and confers no rights.0 -
dmccrae wrote:Yes you can bind the data of the control to an AL Text or BigText variable and have it handled as a C# String or Object type in the control.
Yes, but what about case when I have some customized edit box, it means the text to which it is bounded, is used as data, but I need to push some more data to the addin (not only the data string, but some settings or something like that)? Will it means that I need to envelop the data and settings into the string, pass it into the addin, and when saving, remove them and save only the plain data?0 -
kine wrote:You can fire one predefined event from the control with two parameters: one Integer and one String. There is trigger in NAV for this event. It means you can use this trigger as generic event of the control and use the integer to select what you want to fire in NAV etc.
In some future versions there will be (may be) event support for the control (each event will have trigger in NAV), but not now...
thanks!0 -
See http://www.mibuso.com/dlinfo.asp?FileID=1104 slide no. 13. 8)0
-
Thank a lot.0
-
Kamil, yes it is currently limited in this respect. You need to construct your own data protocol to encapsulate the kind of additional data you're describing.Dean McCrae - Senior Software Developer, NAV Server & Tools
This posting is provided "AS IS" with no warranties, and confers no rights.0 -
dmccrae wrote:Kamil, yes it is currently limited in this respect. You need to construct your own data protocol to encapsulate the kind of additional data you're describing.
Ok, good to know. Do you think that there is some way around through using the functions in the dlls which are in the client folder? I can do databinding etc. with them... but I do not have enough knowledge about the model yet...0 -
That does not sound possible, because you will still need to communicate everything through the Client Extensibility provided interfaces.Dean McCrae - Senior Software Developer, NAV Server & Tools
This posting is provided "AS IS" with no warranties, and confers no rights.0 -
OK, now that we have the functionality in our hands, we should talk about it, i think...
I tried to develop a simple add-in like the one descripted on msdn: http://msdn.microsoft.com/en-us/library/dd983804.aspx
After 1h and a half i managed to get it work, but i have some questions:
1. can i call methods of the add-in from C-al code?
2. can i use add-ins on list pages?If yes, how?and why the descripted add-in does not work?
3. can "onControladdin" trigger be fired from C/al? (i don't think so)
4. consider this situation: I developed an add-in that must be used from every textbox in Nav and there's some code in the oncontroladdin trigger: Do I have to copy-paste the property and the code in each control?Or is there an Onglobalcontroladdin that can be overwritten?
5. About the sample control add-in described in the link: how can i color the text?(this is a C# development question)
6. What about future versions?I mean, is it useful to spend time with these add-ins or will them be replaced by something else? (e.g.: when C# development for nav will take effect)
Thanks in advance0 -
3. No, as any other automation events...
4. I am afraid that you need to copy all what you need, there is no "global" way. Addin is there to replace some specific fields, not "change" the whole interface in general...
5. I think it is Control.Font.Color
6. They will not be replaced, they will be extended... :-)0 -
kine wrote:3. No, as any other automation events...
4. I am afraid that you need to copy all what you need, there is no "global" way. Addin is there to replace some specific fields, not "change" the whole interface in general...kine wrote:5. I think it is Control.Font.Colorkine wrote:6. They will not be replaced, they will be extended...0 -
5. Ok, than try "Control.ForeColor" (http://msdn.microsoft.com/en-us/library ... mbers.aspx)0
-
:thumbsup: it works, next step is to define the color for example like this
customer name is blue if his balance is <0, otherwise it is yellow.
(i know that there's a new property that support some formatting, but i'm here to learn add-ins)0 -
Belias wrote::thumbsup: it works, next step is to define the color for example like this
customer name is blue if his balance is <0, otherwise it is yellow.
(i know that there's a new property that support some formatting, but i'm here to learn add-ins)
It is not easy to do that, because you need to pass the info through the text of the control, or use e.g. BigText as source expression for the control and fill it with all data which the addin needs and where it will return what you need... (you can pass whole XML file to the addin in this way - I recommend to look at this webcast if you are MS partner and you have access to trainings).0 -
Too bad...i hoped that there were something like a dataset of the page that could be accessed by the add-in (hope to be understood).
In other words, kine, you're saying that now there's not an easy way to create add-ins which depends from the actual content of the page... :-k0 -
Yes, it is not easy now. You need to pass the data through the control which is the source for the addin. But it could be done, in the webcast there is complex addin with some chart for customers you have filtered on the page, which is based on bigtext field, which is populated by the data for the filtered customers... and you can pass the changes through the bigtext back or through the event...0
-
A first use of custom add ins, which is nearly out of the box (for who do not know C# at all) is to call triggers that would instead be impossible to call in nav e.g. OnMousehover.
The developer have to program just 20 lines of code in c# and he's done.
Just follow http://msdn.microsoft.com/en-us/library/dd983804.aspx to create/register the dll (it was an hard work for me ](*,) ). Then delete the code in it and make something like this:using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Dynamics.Framework.UI.Extensibility; using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms; using System.Windows.Forms; using System.Drawing; namespace MyCompany.MyProduct.RtcAddins { [ControlAddInExport("MyCompany.MyProduct.FieldPopupAddin")] public class MyFieldPopupAddin : StringControlAddInBase { /// Defines the text box control. protected override Control CreateControl() { TextBox control = new TextBox(); control.MouseHover += control_OnMouseHover; //ADD HERE MORE EVENTS WITH THE SAME SYNTAX return control; } /// Raises an event on Mouse Hover (this event does nothing except running the code in "OnControlAddIn" trigger). private void control_OnMouseHover(object sender, EventArgs e) { int index = 0; string data = this.Control.Text; this.RaiseControlAddInEvent(index, data); } } }
0 -
The main difference between COM and our Add-ins is:
- COM is method / event oriented communication
- Add-ins use a document based communication:
+ Bind the Add-in to data (simpple value or even XML through BigText / Blob binding
+ Add-in receives data through binding, can be asked to deliver changed data when saving and can initiate saving
+ Add-ins can fire one generic to trigger C/AL code (message id / text)
It can be really harder to encapsulate a strong method / event oriented interfacing of COM objects into the document based communication. If you have control on the COM objects, it might be easier to rewrite those and replace the interfacing with a document based communication. (I have seen a case, where this document based communiation was even much better for the purpose of what those COM objects in this case were doing.)“This posting is provided "AS IS" with no warranties, and confers no rights.”
Christian Abeln
Program Manager Microsoft
Dynamics NAV
blogs.msdn.com/cabeln/0 -
you can also automatically run reports from add-ins with this instruction...but i don't know if it useless, as you can do the same from nav in a simpler way...add this in the protected override Control CreateControl()
System.Diagnostics.Process.Start("DynamicsNAV:////runreport?report=50000");
0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions