diff --git a/common/dialogs/dialog_configure_paths.cpp b/common/dialogs/dialog_configure_paths.cpp
index 342dfa47f1..e863c657d0 100644
--- a/common/dialogs/dialog_configure_paths.cpp
+++ b/common/dialogs/dialog_configure_paths.cpp
@@ -62,7 +62,8 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
m_resolver( aResolver ),
m_gridWidth( 0 ),
m_gridWidthsDirty( true ),
- m_helpDialog( nullptr )
+ m_helpBox( nullptr ),
+ m_heightBeforeHelp( 400 )
{
m_btnAddEnvVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_btnDeleteEnvVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
@@ -128,9 +129,6 @@ DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS()
m_SearchPaths->PopEventHandler( true );
m_EnvVars->PopEventHandler( true );
- if( m_helpDialog )
- m_helpDialog->Destroy();
-
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
nullptr, this );
@@ -594,14 +592,12 @@ void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
m_gridWidthsDirty = false;
}
- // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
- // even when the original validation was triggered from a killFocus event (and for
- // dialog with notebooks, so that the corresponding notebook page can be shown in
- // the background when triggered from an OK).
+ // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus even when
+ // the original validation was triggered from a killFocus event.
if( m_errorGrid )
{
- // We will re-enter this routine when the error dialog is displayed, so make
- // sure we don't keep putting up more dialogs.
+ // We will re-enter this routine when the error dialog is displayed, so make sure we don't
+ // keep putting up more dialogs.
wxGrid* grid = m_errorGrid;
m_errorGrid = nullptr;
@@ -628,38 +624,55 @@ void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
{
- if( m_helpDialog )
+ wxSizer* sizerMain = GetSizer();
+
+ if( !m_helpBox )
{
- m_helpDialog->ShowModeless();
- return;
+ m_helpBox = new HTML_WINDOW( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+ wxHW_SCROLLBAR_AUTO );
+
+ wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
+ "are names that have been defined externally at the system or user "
+ "level. Environment variables defined at the system or user level "
+ "take precedence over the ones defined in this table. This means the "
+ "values in this table are ignored." );
+ msg << "
";
+ msg << _( "To ensure environment variable names are valid on all platforms, the name field "
+ "will only accept upper case letters, digits, and the underscore characters." );
+ msg << "";
+
+ for( const wxString& var : ENV_VAR::GetPredefinedEnvVars() )
+ {
+ msg << "
" << var << "";
+
+ const auto desc = ENV_VAR::LookUpEnvVarHelp( var );
+
+ if( desc.size() > 0 )
+ msg << ": " << desc;
+
+ }
+
+ m_helpBox->SetPage( msg );
+ m_helpBox->Show( false );
+
+ sizerMain->Insert( sizerMain->GetItemCount() - 1, m_helpBox, 1, wxALL|wxEXPAND, 10 );
}
- wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
- "are names that have been defined externally at the system or user "
- "level. Environment variables defined at the system or user level "
- "take precedence over the ones defined in this table. This means the "
- "values in this table are ignored." );
- msg << "
";
- msg << _( "To ensure environment variable names are valid on all platforms, the name field "
- "will only accept upper case letters, digits, and the underscore characters." );
- msg << "";
-
- for( const auto& var : ENV_VAR::GetPredefinedEnvVars() )
+ if( m_helpBox->IsShown() )
{
- msg << "
" << var << "";
+ m_helpBox->Show( false );
+ SetClientSize( wxSize( GetClientSize().x, m_heightBeforeHelp ) );
+ }
+ else
+ {
+ m_helpBox->Show( true );
+ m_heightBeforeHelp = GetClientSize().y;
- const auto desc = ENV_VAR::LookUpEnvVarHelp( var );
-
- if( desc.size() > 0 )
- msg << ": " << desc;
+ int minHelpBoxHeight = GetTextExtent( wxT( "T" ) ).y * 20;
+ if( GetClientSize().y < minHelpBoxHeight * 2 )
+ SetClientSize( wxSize( GetClientSize().x, GetClientSize().y + minHelpBoxHeight ) );
}
- m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Environment Variable Help" ) );
- m_helpDialog->SetDialogSizeInDU( 400, 250 );
-
- m_helpDialog->AddHTML_Text( msg );
- m_helpDialog->ShowModeless();
-
- // m_helpDialog will be destroyed when closing the dialog
+ Layout();
}
diff --git a/common/tool/common_control.cpp b/common/tool/common_control.cpp
index 59c4f3d0e7..78f7d03427 100644
--- a/common/tool/common_control.cpp
+++ b/common/tool/common_control.cpp
@@ -113,8 +113,7 @@ int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
{
DIALOG_CONFIGURE_PATHS dlg( m_frame, nullptr );
- // Use QuasiModal so that HTML help window will work
- if( dlg.ShowQuasiModal() == wxID_OK )
+ if( dlg.ShowModal() == wxID_OK )
m_frame->Kiway().CommonSettingsChanged( true, false );
}
diff --git a/include/dialogs/dialog_configure_paths.h b/include/dialogs/dialog_configure_paths.h
index 85905aa282..6cfc2a5c38 100644
--- a/include/dialogs/dialog_configure_paths.h
+++ b/include/dialogs/dialog_configure_paths.h
@@ -32,7 +32,7 @@
class FILENAME_RESOLVER;
-class HTML_MESSAGE_BOX;
+class HTML_WINDOW;
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
@@ -74,7 +74,8 @@ private:
int m_gridWidth;
bool m_gridWidthsDirty;
- HTML_MESSAGE_BOX* m_helpDialog;
+ HTML_WINDOW* m_helpBox;
+ int m_heightBeforeHelp;
};
#endif // _DIALOG_CONFIGURE_PATHS_H_