Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows GUI: Improve app closing routine #872

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading