Skip to main content
Associate III
July 15, 2026
Question

Feature Request: hide modal on shade press

  • July 15, 2026
  • 3 replies
  • 53 views

Request: Add an option to the ModalWindow to hide the modal when the shade is pressed. Also add a switch in the Properties panel in Designer

This can be implemented as simply as:
 

namespace touchgfx
{

class ModalWindow: public Container
{
public:
ModalWindow:
// ...
shadePressedCallback(this, &ModalWindow::shadePressedCallbackHandler),
shadeWasPressed(false),
hideOnShadePressed(false)
{
backgroundShade.setClickAction(shadePressedCallback);
windowContainer.setTouchable(true);
}

// ...

// some setter/getter for `hideOnShadePressed`

void shadePressedCallbackHandler(const Box &box, const ClickEvent &event)
{
bool pressed = event.getType() == ClickEvent::PRESSED;
if (hideOnShadePressed && &box == &backgroundShade && shadeWasPressed && !pressed)
{
hide();
}
shadeWasPressed = pressed;
}
protected:
// ...
Callback<ModalWindow, const Box&, const ClickEvent&> shadePressedCallback;
bool shadeWasPressed;
bool hideOnShadePressed;
};

}

 

3 replies

Associate III
July 15, 2026

Tested with:

Associate III
July 15, 2026

Or to make it more general and provide a callback that gets executed when the shade is pressed

ST Technical Moderator
August 12, 2026

Hello Aron,

Thank you for your suggestion. I will forward your idea to our development team, but I do not think that you should sit and wait for this to be implemented.

You can create your own custom ModalWindow, by copying the ModalWindow source files, renaming it and adding the functionality you need. The only downside to this is that you then have to manually add and setup this one widget to your screen in user code instead of TouchGFX Designer.

Best regards,

Peter