Skip to content

Fire Event when TDialog Window is closed on the Close-Button-Character #144

Answered by magiblot
paule32 asked this question in Q&A
Discussion options

You must be logged in to vote

That's because the cmClose command is also handled by TWindow::eventHandle. So, in this case, you should check for the cmClose command before calling TWindow::eventHandle.

However, you must take into account that the close() method destroys the current object, so you must make sure that you do not interact with it after calling close(): do not call clearEvent nor TWindow::handleEvent if you called close(). For example:

void handleEvent(TEvent & event ){
    // Handle cmClose first to override the handling in TWindow.
    if (event.what == evCommand && event.message.command == cmClose)
    {
        messageBox("blaa blaa",mfInformation|mfOKButton);
        clearEvent(event);
        close(…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by paule32
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #142 on February 01, 2024 10:12.