web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Managed host - Message pane host

(0) ShareShare
ReportReport
Posted on by

Hello guys,

I have difficulty finding information about how managed host controls are used and work in Dynamics AX. Especially the message pane host. I am currently using it to display a single message which it does fine, but I know that it can also work as a drop down list with different information on each row of the list, however I can't for the life of me understand how to replicate this behavior.

Does anyone have knowledge about the message pane host and can help me? Or at least know of a good resource where I can look it up? I have already checked the MSDN.

Best regards / Charadas

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Managed host is allows you to use WinForms and WPF controls in AX. You can develop anything inside those controls.

    Which specific control are you talking about (when you say "message pane") and what are you trying to achieve with it? How do you know that it's the right control for your requirement?

  • Community Member Profile Picture
    on at

    Okay... well, this is part of the problem, it sounds very nice that one can develop "anything" inside a managed host, but it doesn't help me understand how. (Maybe I should mention that I'm quite new to AX, I'm a junior java/c# developer that have taken a five day course on AX and worked with it for about two months).

    Anyhow, what I was asked to do was to, on a form that shows party-information, use a managed host that had been used before in order to display a notification message on a party. I'll show you some code:

    from class declaration:

    Microsoft.Dynamics.Framework.UI.WinForms.Controls.MessagePane   messagePane;

    Microsoft.Dynamics.Framework.UI.WinForms.Controls.MessageBar    messageBar;

    method init message bar

    /// <summary>
    /// Initializes the message bar for displaying the configuration status and actions.
    /// </summary>
    public void initMessageBar()
    {
        Microsoft.Dynamics.Framework.UI.WinForms.Controls.MessageBarType messageBarType;
        MWM_tCustOBSCode custOBSCode;

        messageBarType = Microsoft.Dynamics.Framework.UI.WinForms.Controls.MessageBarType::InformationOnly;
        messageBar = new Microsoft.Dynamics.Framework.UI.WinForms.Controls.MessageBar();
        messageBar.set_MessageBarType(messageBarType);

        select count(RecId) from custOBSCode where custOBSCode.CustTableRefRec == tCustTable.RecId;

        messageBar.set_Text(strFmt('Kund har %1 st aktiva OBS', custOBSCode.RecId ));
        messagePane.Add(messageBar);

    }

    Now, this gives me a yellow bar that displays how many OBS, or rather notifications, a party has, but as I was trying out a few things I saw that you could have a drop down menu from the bar. And that would be a perfect place to display additional information about each notification, but I don't understand how and thus hoped someone could point me in the direction of a white paper, blog post, anything, that would explain these managed hosts in a different way than is done in MSDN.

    Sorry for being wordy, hope it makes more sense now.

    /Charadas

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    I didn't know you want to know to develop your own managed controls. If it's the case, look at my article Tutorial: WPF User Control for AX2012. Of course, if you familiar with neither with Windows Forms nor WPF, you will have some extra things to learn. Note that this is an advanced topic - managed controls are not the normal for building AX forms and most AX developers have never built any managed control in their life.

    If you're a complete novice to AX, you shouldn't try to build the architecture by yourself. There is a huge risk and that you get it wrong the beginning, simply because you're not yet familiar with features of Dynamics AX.

    Could you please forget code for a minute and explain the functional requirement you're trying to implement?

  • Community Member Profile Picture
    on at

    Hello again Martin,

    thank you for this answer, now it makes much more sense. However, I don't think I actually need to try and create a completely custom control. So let's see. When I am in the design node of my DirPartyOverview-form I can chose a new design element called managed host. I then chose "Microsoft.Dynamics.Framework.UI.WinForms.Controls" in the top box and "MessagePane" in the bottom box. Why I choose this control is because it has been used before and has the design we're looking for.

    So when I use the code in my previous post a yellow bar with the text "customer has 3 notifications" displays on the form page. We would like to be able to see exactly what these three notifications are on the yellow bar and we would also like the bar to change dynamically in size depending on the amount of notifications, some customers have tree, others might have only one.

    Now, when I troubleshooted an update issue I realised that if you write messagePane.Add(messageBar) in the code several times (the update issue made it so that the old messageBar was not removed) it made the yellow bar on the form page appear as a drop down menu. And that is what we want, but I can't figure out how to do it without instantiating several message bars with different texts.

    Does it make more sense now?

    /Charadas

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    I apologize, but I don't follow you precisely. You say that you already know how to add several messages (by adding several message bars), but you don't like it for some reason. What's the problem with creating multiple message bars?

    An alternative may be using an action (a button in message bar) pointing to a form with related details.

  • Community Member Profile Picture
    on at

    Don't apologize, my English is clearly not the best. I'll try again and explain what I'm asking for in the first post.

    I was asked to display a piece of information on a customer's overview form I was told to do this by the means of a managed host. I was also shown another form where that particular managed host was used. Then I was sent on my merry way. I began googling to find what a managed host actually was and how to use it, I didn't know there were so many and that you even could make your own then. I found a page concerning managed hosts at MSDN, but I didn't understand it that well and that's when I decided to post my question here instead.

    Meanwhile I worked on the control as best as I could and managed to produce the code you see above. This displays the control and message within the control. However, when I was fixing another problem I saw that you could stack message bar-controls on top of each other to create a drop down menu. However, if I just stack the same instance of the message bar on top of itself I only seem to be able to set one text. I'm not good enough to look at the methods of the message bar or the message pane and know which one to use in which scenario. So if there's impossible to find more general information about managed hosts, I would at least like to have an explanation of this one, I mean, it ought to exist some information on it's intended use, or?

    Now, if I still don't make sense, we can move on and leave this question, at the moment I've solved the issue by displaying all the information on one message bar with no drop down, it works so everything is fine.

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    From this statement:

    I realised that if you write messagePane.Add(messageBar) in the code several times [...] it made the yellow bar on the form page appear as a drop down menu. And that is what we want, but I can't figure out how to do it without instantiating several message bars with different texts.

    I understood that you know how to do it and just don't want to use several message bars (which didn't make much sense to me, so that's why I asked why). But now you're saying that you "can't [...] understand how to replicate this behavior".  It seems to me that you meant several message panes, not message bars, which changes the meaning completely. It would mean that you manage it by using several managed hosts with message panes, each displaying a single message bar. Correct?

    I'm not familiar with the drop-down list. Can you give me an example where we can see it?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans