コード例 #1
0
static void
Main()
{
  GeoPoint value = GeoPoint(Angle::Degrees(7.7061111111111114),
                            Angle::Degrees(51.051944444444445));

  if (!GeoPointEntryDialog(_T("The caption"), value, format, true))
    return;

  if (value.IsValid())
    _tprintf(_T("%s\n"),
             FormatGeoPoint(value, CoordinateFormat::DDMMSS).c_str());
  else
    printf("invalid\n");
}
コード例 #2
0
ファイル: RunGeoPointEntry.cpp プロジェクト: MindMil/XCSoar
static void
Main()
{
  GeoPoint value = GeoPoint(Angle::Degrees(7.7061111111111114),
                            Angle::Degrees(51.051944444444445));

  if (!GeoPointEntryDialog(_T("The caption"), value, true))
    return;

  if (value.IsValid()) {
    TCHAR buffer[64];
    _tprintf(_T("%s\n"), FormatGeoPoint(value, buffer, ARRAY_SIZE(buffer),
                                        CoordinateFormat::DDMMSS));
  } else
    printf("invalid\n");
}
コード例 #3
0
ファイル: DataField.cpp プロジェクト: kwtskran/XCSoar
bool
EditDataFieldDialog(const TCHAR *caption, DataField &df,
                    const TCHAR *help_text)
{
  if (df.GetType() == DataField::Type::FILE) {
    return FilePicker(caption, (FileDataField &)df, help_text);
  } else if (df.SupportsCombolist()) {
    return ComboPicker(caption, df, help_text);
  } else if (df.GetType() == DataField::Type::ROUGH_TIME) {
    RoughTimeDataField &tdf = (RoughTimeDataField &)df;
    RoughTime value = tdf.GetValue();
    if (!TimeEntryDialog(caption, value, tdf.GetTimeZone(), true))
      return false;

    tdf.ModifyValue(value);
    return true;
  } else if (df.GetType() == DataField::Type::GEOPOINT) {
    GeoPointDataField &gdf = (GeoPointDataField &)df;
    GeoPoint value = gdf.GetValue();
    if (!GeoPointEntryDialog(caption, value,
                             gdf.GetFormat(),
                             false))
      return false;

    gdf.ModifyValue(value);
    return true;
  } else {
    const TCHAR *value = df.GetAsString();
    if (value == NULL)
      return false;

    StaticString<EDITSTRINGSIZE> buffer(value);

    PrefixDataField::AllowedCharactersFunction acf;
    if (df.GetType() == DataField::Type::PREFIX)
      acf = ((PrefixDataField &)df).GetAllowedCharactersFunction();

    if (!TextEntryDialog(buffer, caption, acf))
      return false;

    df.SetAsString(buffer);
    return true;
  }
}