Skip to content

Commit

Permalink
Merge pull request #872 from cjee21/app-close
Browse files Browse the repository at this point in the history
Windows GUI: Improve app closing routine
  • Loading branch information
JeromeMartinez authored Jun 18, 2024
2 parents 8f8c01a + 5ea1595 commit 9d78f50
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,28 @@ void __fastcall TMainF::FormShow(TObject *Sender)
//---------------------------------------------------------------------------
void __fastcall TMainF::FormClose(TObject *Sender, TCloseAction &Action)
{
if (Page->ActivePage==Page_Sheet) //TODO : find WHY there is a crash without this...
ChangePage(Page_Easy);
//Delete temp HTML file on close
if (FileName_Temp!=__T(""))
File::Delete(FileName_Temp);

//The form is closed and all allocated memory for the form is freed.
Action = caFree;
}

//---------------------------------------------------------------------------
void __fastcall TMainF::FormDestroy(TObject *Sender)
{
delete Prefs; Prefs=NULL;
delete I; I=NULL;
}

//---------------------------------------------------------------------------
void __fastcall TMainF::FormResize(TObject *Sender)
{
//If triggered on application close
if(Prefs==NULL)
return;

//Main View
Page->Left =(ToolBar->Visible?ToolBar->Width:0)-2;
Page->Width =ClientWidth-Page->Left+2;
Expand Down
3 changes: 2 additions & 1 deletion Source/GUI/VCL/GUI_Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object MainF: TMainF
Font.Style = []
Menu = MainMenu
OnClose = FormClose
OnDestroy = FormDestroy
OnResize = FormResize
OnShow = FormShow
TextHeight = 13
Expand Down Expand Up @@ -2090,7 +2091,7 @@ object MainF: TMainF
end
object MainMenu: TMainMenu
Images = Menu_Image
Left = 764
Left = 768
Top = 28
object M_File: TMenuItem
Caption = 'File'
Expand Down
1 change: 1 addition & 0 deletions Source/GUI/VCL/GUI_Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class TMainF : public TForm
void __fastcall Page_Easy_FileChange(TObject *Sender);
void __fastcall Page_Easy_DifferentViewClick(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall Page_Sheet_Change(TObject *Sender);
void __fastcall Page_Sheet_WebClick(TObject *Sender);
void __fastcall Page_Easy_WebClick(TObject *Sender);
Expand Down

0 comments on commit 9d78f50

Please sign in to comment.