Mbox set_size using simulator

btns = [
        "1", "2", "3", "4", "5", "\n",
        "6", "7", "8", "9", "0", "\n",
        "Close", "Clear", "OK", ""]

mbox1 = lv.mbox(lv.scr_act())
mbox1.set_text(“Enter Pin Number”);
mbox1.add_btns(btns)
mbox1.set_size(200, 200)
mbox1.align(None, lv.ALIGN.CENTER, 0, 0)

Have also tried…

Please provide your code as text.

Added code above

Try this: Link to script

The trick is to cast mbox1 to lv.cont before calling set_fit.

@kisvegabor, @embeddedt I think you should consider adding set_fit either to lv_obj or to all objects that might need it. Casting objects like this is not straightforward and as we discussed in the past all objects inherit directly from lv_obj (and not from lv_cont for example).

The Buttons did not scale with cont

Should it?

The Message boxes act as pop-ups. They are built from a background Container, a Label and a Button matrix for buttons.

If it is made with Button matrix (lv_btnm) and lv_btmn scales… it should

In similar cases, we should rather add API function(s) for the required functionality.

However, the issue here is that the button matrix in the message box assumes it has only one line and sets its height accordingly.

I’ve fixed it dev-7.0: https://github.com/littlevgl/lvgl/commit/2d71bc7cc584a24157e098760633f33792c23a33
You can either manually apply the fix in master or craft a message box from a “normal” container + label + button matrix to have full control.

1 Like

Thank you for clarifying.
I did the ladder and work fine.
It should be documented that this function only gives you one line of buttons and non scalable.