FXDialogBox::ID_CLOSE versus FXDialogBox::ID_CANCEL

"John Selverian" <[email protected]> Wed, 26 Jul 2023 10:21:37 -0400
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization JAHM Software
Message-ID <[email protected]>

I'm running on Win11 with v1.7.50

 

When I use this:

 

                new FXButton(bottom_HF_0, "Close", nullptr, this,
FXDialogBox::ID_CLOSE, FRAME_RAISED | FRAME_THICK |
BUTTON_DEFAULT);

 

the program crashes:

 

 

when I use this 

 

                new FXButton(bottom_HF_0, "Close", nullptr, this,
FXDialogBox::ID_CANCEL, FRAME_RAISED | FRAME_THICK |
BUTTON_DEFAULT);

 

 

it doesn't.what's the difference?

 

 

 

When it crashed it crashes in here on the "x:  delete this;" line

 

 

 

// Attempt to close the window, return true if actually closed

FXbool FXTopWindow::close(FXbool notify){

  register FXWindow *window;

 

  // Ask target if desired

  if(!notify || !target ||
!target->tryHandle(this,FXSEL(SEL_CLOSE,message),NULL)){

 

    // Target will receive no further messages from us

    setTarget(NULL);

    setSelector(0);

 

    // If there was another main level window still visible,
that's all we do

    for(window=getRoot()->getFirst(); window;
window=window->getNext()){

      if(window!=this &&
window->isMemberOf(FXMETACLASS(FXMainWindow))){

        goto x;

        }

      }

 

    // We've just hidden the last remaining top level window:-
quit the application

 
getApp()->handle(this,FXSEL(SEL_COMMAND,FXApp::ID_QUIT),NULL);

 

    // Self destruct

x:  delete this;

 

    // Was closed

    return true;

    }

  return false;

  }

 

 

 

 

 

Kind regards,

 

js

_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users
image001.gif (image/gif, 70 B) - not displayed