Is it possible to set the width of msgbox in code ?


Is it possible to set the width of msgbox in code ?

If so, how can I do it?

Thanks. Lennox.

no, you will need to create your own custom control

Thanks Dave.

from Dave:

I do not know if this is of any value, but I just needed to do this same thing in Swift and here is what I found

  let newWidth : CGFloat = 400-270 // NEW Width is 400 (270 is old width)

        // update width constraint value for main view
        if let viewWidthConstraint = alertController.view.constraints.filter({ return $0.firstAttribute == .width }).first{
            viewWidthConstraint.constant = newWidth

        // update width constraint value for container view
        if let containerViewWidthConstraint = alertController.view.subviews.first?.constraints.filter({ return $0.firstAttribute == .width }).first {
            containerViewWidthConstraint.constant = newWidth

perhaps someone can make a custom subclass using this information for BS

Unfortunately there’s currently no way to get in and manipulate the MsgBox or MessageDialog as the handle is not available.

I have a feature request for it, but it’s not been “handled” yet.

So it means that I must create a NSAlert class in code, just to change a few little things.