MessageBox Width

Answered
0
0

Hi.

I have noticed the MessageBox will try to size itself to fit the view area where it is shown, but I guess it takes into consideration the whole page. As in the picture attached, we can see the MessageBox shrinked a bit breaking the message text into 2 lines, which is cool, but wasn’t enough since it is shown in a Desktop control and its sides get cropped. Is there a way to workaround this and have it resized to fit the Desktop control behind it?

Thanks in advance.

Ivan

Attachment
  • You must to post comments
Best Answer
0
0

No, the maxWidth and maxHeight are absolute properties. I checked the js code and the wisej.web.MessageBox class (https://github.com/iceteagroup/wisej-js/blob/master/wisej.web.MessageBox.js) limits itself to the window.innerWidth which unfortunately means that it may exceed the Desktop child control. See the _onAppear(e) method.

You can override it with a js patch, see attached zip. Gives you 2 options: 1- maximize the messagebox (which could be a good idea on mobiles), 2-limit the size to the parent.

  • Luca (ITG)
    If you are using VB.NET the Platform folder doesn’t work because of the way the VB.NET compiler creates embedded resources. You can keep the Platform folder (VB.NET ignores it) but rename the file “Platform.MessageBoxPatch.js) see https://wisej.com/docs/2.2/html/EmbeddedResources.htm (for VB.NET developers warning).
  • Ivan Borges
    Nope, C# here, but I will check the documentation link.
  • Ivan Borges
    Even though it is C#, I followed the instructions and renamed the file, but still not working.
  • Luca (ITG)
    Try in a new project copying the code from the sample I attached.
  • Ivan Borges
    Yep, it worked just fine in a new project. I know there must be something preventing it in my original solution, I just don’t know what to check.
0
0

Hi Luca.

I think I found the issue with the patch not being called in my Solution. It looks like if the Assembly Name has spaces in it, it just won’t load the patch, which is my case. I have changed your sample’s Assembly Name from “Wisej.MessageBoxPatch” to “Wisej MessageBoxPatch” and it results in the same issue. I attached it here.

Now, I don’t know if this is an issue or a feature. Is it a bad practicing with Wisej to have spaces in the DLL names?

  • Luca (ITG)
    The issue is that the C# compiler embeds embedded resources using the default namespace, in your case it’s “Wisej.MessageBoxPatch.Platform.MessageBoxPatch.js”. But there is no way in .NET to read the “default namespace” so Wisej assumes that it’s the same as the assembly name, which is usually the case. Otherwise you can specify the root name of the embedded Wisej resources using the RootName argument: [assembly: Wisej.Core.WisejResources(RootName: “Wisej.MessageBoxPatch”)]
  • Ivan Borges
    Great information, Luca. Thank you! And it was in the documentation all the time :-) “The attributes takes two optional parameters to let you specify a list of excluded resource names and the root name of the resources when it’s different from the default namespace.”
  • You must to post comments
0
0

Thank you Luca for the help, this gives me a starting point.

But I guess I should deal with the size right before I show the message, since the Desktop control could be any size at this moment and then I should take the Desktop width into consideration to be able to calculate the MessageBox width and make sure it would be a bit narrower than its Desktop parent. Can this be accomplished just having a different mixin?

  • You must to post comments
0
0

You set the maxHeight and maxWidth properties for the “messagebox” appearance in the theme or mixin or programmatically changing the theme.

The maxHeight/Width can be applied either for the whole message box or to the content components and the container will adapt.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.