Changeset 170 for trunk/Forms


Ignore:
Timestamp:
Jul 2, 2023, 11:07:39 PM (18 months ago)
Author:
chronos
Message:
  • Fixed: Show only supported import formats.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormImport.pas

    r168 r170  
    6868procedure TFormImport.ComboBoxInputFormatChange(Sender: TObject);
    6969begin
    70   UpdateTableFormat;
     70  RedrawPending := True;
    7171end;
    7272
     
    7474begin
    7575  RedrawPending := True;
     76  UpdateTableFormat;
    7677end;
    7778
     
    8990var
    9091  TableFormat: TTableFormat;
     92  TableFormats: TTableFormats;
    9193begin
     94  Table := TTable.Create;
     95
     96  TableFormats := Table.GetInputFormats;
    9297  ComboBoxInputFormat.Items.BeginUpdate;
    9398  try
    9499    for TableFormat := Low(TTableFormat) to High(TTableFormat) do
    95     if TableFormat <> tfListView then
     100    if TableFormat in TableFormats then
    96101      ComboBoxInputFormat.Items.AddObject(TableFormatText[TableFormat], TObject(TableFormat));
    97102    if (ComboBoxInputFormat.ItemIndex = -1) and (ComboBoxInputFormat.Items.Count > 0) then
     
    101106  end;
    102107
    103   Table := TTable.Create;
    104108  LoadConfig;
    105109  UpdateTableFormat;
     
    141145begin
    142146  FileExt := ExtractFileExt(EditInputFile.Text);
    143   if FileExt = '.xml' then
    144     ComboBoxInputFormat.ItemIndex := ComboBoxInputFormat.Items.IndexOfObject(TObject(tfXml))
     147  if FileExt = '.json' then
     148    ComboBoxInputFormat.ItemIndex := ComboBoxInputFormat.Items.IndexOfObject(TObject(tfJson))
    145149  else if FileExt = '.csv' then
    146150    ComboBoxInputFormat.ItemIndex := ComboBoxInputFormat.Items.IndexOfObject(TObject(tfCsv))
    147   else if (FileExt = '.htm') or (FileExt = '.html') then
    148     ComboBoxInputFormat.ItemIndex := ComboBoxInputFormat.Items.IndexOfObject(TObject(tfHtml));
     151  else if FileExt = '.txt' then
     152    ComboBoxInputFormat.ItemIndex := ComboBoxInputFormat.Items.IndexOfObject(TObject(tfMediaWiki));
    149153end;
    150154
Note: See TracChangeset for help on using the changeset viewer.