Result of built-in MessageBox opened from a button

sgronchi
2020-06-09
2020-06-15
  • sgronchi

    sgronchi - 2020-06-09

    Hi all,
    anyone knows how to get the Yes/No or Ok/Cancel answer from the VisuDialogs.MessageBox?
    Digging into the library, the related visualization has only input, no output or in_out, so it must have another way to communicate which button was pressed (if not, what's the point to have two buttons in the first place?), but I was not able to find it.
    It should be opened by pressing on a (visualized) button.
    Or am I forced to make a custom dialog from scratch to return the pressed button?

     
  • marci4

    marci4 - 2020-06-15

    Hello @sgronchi,

    you can receive the result with the attached example.

    Just keep in mind to check the box for active visualizations in the visu manager.

    Best regards,
    Marcel

     

    Last edit: marci4 2020-06-15
  • sgronchi

    sgronchi - 2020-06-15

    Thanks. I am on 3.5.14, so I cannot see definition of VisuElems.Visu_DialogResult (I noticed that it is '6' for Yes and '7' for no, STRING since the formatter is %s, right?). Is it defined in an enumeration?
    Also, I still wonder why not the implementers just use a VAR_IN_OUT variable instead of requiring this hairy workaround. I am puzzled, I am sure there IS a reason, but I cannot understand what it is.

     
  • marci4

    marci4 - 2020-06-15

    My bad, enum is hidden.

    The reason is pretty simple.
    The dialog result (e.g. cancel, yes) are used in different dialogs to write back the values e.g. only when OK is pressed.
    The messagebox is designed the same way.

    The "problem" is that there is no nice way to access the result of the dialog via input action.
    I added an improvement for this.

    Best regards,
    Marcel

     
  • sgronchi

    sgronchi - 2020-06-15

    Thank you!

     

Log in to post a comment.