Skip to content

Commit

Permalink
UI logic update
Browse files Browse the repository at this point in the history
when GeoDa loads a table-only data source, only "Variables" based "Distance Weight" is enabled in Weights File Creation dialog.
  • Loading branch information
lixun910 committed Feb 20, 2019
1 parent 20ec4c5 commit 9f4ba03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion DialogTools/CreatingWeightDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ void CreatingWeightDlg::CreateControls()

m_nb_weights_type->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED,
&CreatingWeightDlg::OnWeightTypeSelect, this);
m_nb_distance_variables->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED,
&CreatingWeightDlg::OnWeightVariableSelect, this);
m_nb_distance_variables->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED,
&CreatingWeightDlg::OnDistanceWeightsInputUpdate, this);
m_Vars->Bind(wxEVT_LISTBOX, &CreatingWeightDlg::OnDistanceWeightsVarsSel, this);
Expand All @@ -236,6 +238,16 @@ void CreatingWeightDlg::OnWeightTypeSelect( wxCommandEvent& event )
if (is_table_only && sel == 0) {
// force to "distance weight"
m_nb_weights_type->SetSelection(1);
m_nb_distance_variables->SetSelection(1);
}
}

void CreatingWeightDlg::OnWeightVariableSelect( wxCommandEvent& event )
{
int sel = event.GetSelection();
if (is_table_only && sel == 0) {
// force to "distance weight"
m_nb_distance_variables->SetSelection(1);
}
}

Expand Down Expand Up @@ -977,7 +989,12 @@ void CreatingWeightDlg::InitDlg()
FindWindow(XRCID("IDC_STATIC_YCOORD_VAR"))->Hide();
m_nb_distance_variables->Hide();
}


if (is_table_only) {
// force to "distance weight"
m_nb_weights_type->SetSelection(1);
m_nb_distance_variables->SetSelection(1);
}
Refresh();
}

Expand Down
1 change: 1 addition & 0 deletions DialogTools/CreatingWeightDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public TableStateObserver, public WeightsManStateObserver
void OnDistanceWeightsVarsSel( wxCommandEvent& event );
void OnDistanceMetricVarsSel( wxCommandEvent& event );
void OnWeightTypeSelect( wxCommandEvent& event );
void OnWeightVariableSelect( wxCommandEvent& event );
/** Implementation of FramesManagerObserver interface */
virtual void update(FramesManager* o);

Expand Down

0 comments on commit 9f4ba03

Please sign in to comment.