App-InvestSim

 view release on metacpan or  search on metacpan

lib/App/InvestSim/GUI.pm  view on Meta::CPAN

      Tkx::focus('.');
      calculate_all();
    });

  # We're done, we can show the UI.
  $root->g_wm_deiconify();
}

# Update the values displayed in the core value table.
my @computed_values; # The output of compute_all()
sub update_displayed_mode {
  my $current_mode = $modes_combobox->m_current();
  $modes_combobox->m_selection('clear');
  my $format = $modes_format[$current_mode];
  for my $i (0..NUM_LOAN_DURATION-1) {
    for my $j (0..NUM_LOAN_AMOUNT-1) {
      $core_display_values[$i][$j] = $format->($computed_values[$i][$j][$current_mode]);
    }
  }
}

sub clear_displayed_table {
  $display_table->m_delete($display_table->m_children(''));
}

# Update the values displayed in the by-year secondary table.
my (@last_update_to_table);
sub update_displayed_table {
  # loan_duration, $loan_amount
  my ($d, $a) = (@_, @last_update_to_table);
  @last_update_to_table = (@_, @last_update_to_table);
  return if @last_update_to_table == 0;  # automatic call before any selection.
  if ($values{automatic_duration} && $values{loan_durations}[$d] != $values{duration}) {
    $values{duration} = $values{loan_durations}[$d];
    refresh_all_fields();
    return; # This method is called back by refresh_all_fields() through calculate_all().
  }
  clear_displayed_table();



( run in 0.242 second using v1.01-cache-2.11-cpan-95122f20152 )