Delete show message output after some time

4
Hi, We use 'Show 'Message' activities in our flows to alert the user to thing on the screen. For example, if no errors are found, a message in the bottom left will show saying 'Geen fouten in het dossier gevonden'. However. The user must click this message for it to dissappear. Since our users won't be using a mouse very often using this system, I'm wondering if we can automatically remove these messages after a certain amount of time
asked
3 answers
2

As of Mendix 4 I don't think this option is configurable. I think you'll need some custom javascript event to grab the Mendix toasters and add a fade out event to them.

See this dojo documentation: http://dojotoolkit.org/reference-guide/1.7/dojo/fadeOut.html

answered
1

Paul

I don't think you can close those messages automatically. One idea: you could show a popup web form instead and put a microflow timer on that web form that calls a close form microflow after a certain amount of time has elapsed.

Mike

answered
1

So, I have "a" solution that should be cross-browser supported. Some of the other pieces I saw either drained performance or were not supported across browsers like IE. Let me preface this by saying I'm in no way a good js developer. But if you want to test this out, it worked for me:

(function() {

//Set time to check
var checkInterval = 3000,
lastNumOfToasters = 0;

setInterval(function () {
    var toasters = dojo.query('.mendixToaster_message');

    if (lastNumOfToasters == toasters.length)
        for (var i = 0; i < toasters.length; i++)
            toasters[i].click();

    lastNumOfToasters = toasters.length;

}, checkInterval);

})();

Save this text as AddMxToasterFade.js in the 'theme' directory of your project. Then load it in your index3.html page with a basic script tag right below mxui.js.

<script type="text/javascript" src="AddMxToasterFade.js"></script>

I have not done a lot of testing - again, this was a 5 minute solution, but feedback would be great.

answered