void VARIABLES_WINDOW::v_event(  //Process event
                               GRAPHICS_EVENT &g_event) {
  INT32 cmd_event;               //Command event type
  char new_value[80];            //of menu item
  char buff[80];

  COMMAND_WINDOW::event(g_event, &cmd_event, new_value); 

  switch (cmd_event) {
    case NULL_COMMAND:
      break;
    case WRITE_ALL_CMD:
      write_vars(new_value, FALSE); 
      break;
    case WRITE_CHANGED_CMD:
      write_vars(new_value, TRUE); 
      break;
    case KILL_WINDOW_CMD:
      win_assocs.remove (g_event.fd);
      destroy_window (g_event.fd);
      my_creator->child_closed ();
      delete this;
      break;
    default:
      sprintf (buff, "UNPROCESSED EVENT code " INT32FORMAT, cmd_event);
      msg(buff); 
  }
}
ofstream* CovOptimData::write(const char* filename, const CovOptimData& cov, std::stack<unsigned int>& format_id, std::stack<unsigned int>& format_version) {

	format_id.push(subformat_number);
	format_version.push(FORMAT_VERSION);

	ofstream* f = CovList::write(filename, cov, format_id, format_version);

	write_vars   (*f, cov.var_names());
	write_pos_int(*f, cov.optimizer_status());
	write_pos_int(*f, (uint32_t) cov.is_extended_space());
	write_double (*f, cov.uplo());
	write_double (*f, cov.uplo_of_epsboxes());
	write_double (*f, cov.loup());

	if (!cov.loup_point().is_empty()) {
		unsigned int nb_var   = cov.is_extended_space() ? cov.n-1 : cov.n;
		// TODO: we assume here that the goal var is n-1
		if (cov[0].subvector(0,nb_var-1)!=cov.loup_point()) {
			ibex_error("[CovOptimData] the first box in the list must be the 'loup-point'.");
		}
		write_pos_int(*f, (uint32_t) 1);
	} else {
		write_pos_int(*f, (uint32_t) 0);
	}

	write_double(*f, cov.time());
	write_pos_int   (*f, cov.nb_cells());

	return f;
}