Popup (Modal) flags only applied if Closing channel is set

bonjour,

I’m updating the Launcher to the latest VL.ImGUI, and noticed the Has Close Button input on the Popup (Modal) was replaced with a Closing channel that has to be set for the button to show up. Okay.

But it looks like flags are not taken into account if this Closing channel is not set.

To repro, open the attached document :

  1. Even though the flag is set to NoTitleBar, the title bar is there
  2. Now connect the lonely Channel node to the Closing input : the flag is now taken into account

Also, it’s a bit weird to have this Close Clicked output always there even though the region might not have a close button at all if the Channel is not connected.

Voilàvoilà, thanks in advance!

seb

popupclosingchannel.vl (10.2 KB)

Bonjour,

This is by design, but true, a bit clumsy, if you have a better idea - welcome!

Consider these two statements:

  • Our thinking: If you want to be able to close the Modal (by clicking on X), you have to provide a channel to be notified about closing, otherwise there is no chance to know about it.
  • ImGui internally: there are two overloads:
    1. one that takes a label, a pointer (this is our Channel for Closing) and Flags
    2. another one that takes only a label.

So, that means:

  • if you provide a Channel for Closing, we take the first overload and you’ll get the X button and Flags to configure (you can set NoTitleBar there).
  • if you don’t provide a Channel, then we have to switch to the second overload (with no Flags) and ImGui renders Popup with TitleBar (without X) and no chance to configure it.

Use Cases:

  • The only way to get a Modal with TitleBar, but without X (user has to make an action in Modal): don’t provide a Channel for Closing.
  • The only way to get a Modal without TitleBar is to provide a Channel for Closing and to use Flags to hide the TitleBar.

(Note: Modal is not just a normal Popup, Modal prevents any other interaction until user has made a decision. And IF the Modal has X to close it, most of the time it means the same as the Cancel button inside it. If you close the Modal by pressing the Cancel button (which could then enable CloseCurrentPopup), you’ll also be notified about it via the Closing Channel and via the Close Clicked output)

Best,
Anton

1 Like