Grid export: convert format TComboBox to TComboBoxEx with icons

This commit is contained in:
Ansgar Becker
2024-04-21 16:08:14 +02:00
parent a8405070db
commit 5b4afdd2df
2 changed files with 27 additions and 14 deletions

View File

@@ -280,21 +280,30 @@ object frmExportGrid: TfrmExportGrid
DesignSize = (
558
50)
object comboFormat: TComboBox
object comboFormat: TComboBoxEx
Left = 8
Top = 18
Width = 540
Height = 22
Style = csDropDownList
Height = 23
ItemsEx = <
item
Caption = 'Excel CSV'
ImageIndex = 49
SelectedImageIndex = 49
end
item
Caption = 'CSV'
ImageIndex = 50
SelectedImageIndex = 50
end
item
Caption = '...'
end>
Style = csExDropDownList
Anchors = [akLeft, akTop, akRight]
DropDownCount = 20
ItemIndex = 0
TabOrder = 0
Text = 'Excel CSV'
Items.Strings = (
'Excel CSV'
'Delimited Text'
'...')
Images = MainForm.VirtualImageListMain
DropDownCount = 20
end
end
object popupCSVchar: TPopupMenu

View File

@@ -67,7 +67,7 @@ type
btnSetClipboardDefaults: TButton;
chkRemoveLinebreaks: TCheckBox;
grpFormat: TGroupBox;
comboFormat: TComboBox;
comboFormat: TComboBoxEx;
procedure FormCreate(Sender: TObject);
procedure CalcSize(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -170,8 +170,9 @@ uses main, apphelpers, dbconnection;
procedure TfrmExportGrid.FormCreate(Sender: TObject);
var
FormatDesc: String;
ef: TGridExportFormat;
SenderName: String;
comboItem: TComboExItem;
begin
HasSizeGrip := True;
editFilename.Text := AppSettings.ReadString(asGridExportFilename);
@@ -180,8 +181,11 @@ begin
comboEncoding.Items.Delete(0); // Remove "Auto detect"
comboEncoding.ItemIndex := AppSettings.ReadInt(asGridExportEncoding);
comboFormat.Items.Clear;
for FormatDesc in FormatToDescription do
comboFormat.Items.Add(FormatDesc);
for ef:=Low(TGridExportFormat) to High(TGridExportFormat) do begin
comboItem := TComboExItem.Create(comboFormat.ItemsEx);
comboItem.Caption := FormatToDescription[ef];
comboItem.ImageIndex := FormatToImageIndex[ef];
end;
SenderName := Owner.Name;
FHiddenCopyMode := SenderName.StartsWith(CopyAsActionPrefix);