mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Perform some check routines before enabling the "Import"-button.
This commit is contained in:
@ -28,6 +28,7 @@ object loaddataform: Tloaddataform
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'Import!'
|
||||
Default = True
|
||||
Enabled = False
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
OnClick = btnImportClick
|
||||
@ -77,6 +78,7 @@ object loaddataform: Tloaddataform
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 0
|
||||
Text = 'editFilename'
|
||||
OnChange = editFilenameChange
|
||||
OnDblClick = btnOpenFileClick
|
||||
end
|
||||
object btnOpenFile: TBitBtn
|
||||
|
@ -52,6 +52,7 @@ type
|
||||
editLineTerminator: TEdit;
|
||||
lblLineTerminator: TLabel;
|
||||
lblIgnoreLines: TLabel;
|
||||
procedure editFilenameChange(Sender: TObject);
|
||||
procedure btnCancelClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure comboDatabaseChange(Sender: TObject);
|
||||
@ -187,6 +188,9 @@ begin
|
||||
// select all:
|
||||
for i:=0 to chklistColumns.Items.Count-1 do
|
||||
chklistColumns.checked[i] := true;
|
||||
|
||||
// Ensure valid state of Import-Button
|
||||
editFilenameChange(sender);
|
||||
end;
|
||||
|
||||
|
||||
@ -327,4 +331,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{** Make "OK"-button only clickable if
|
||||
- filename is not empty
|
||||
- table is selected
|
||||
- columnnames could be fetched normally
|
||||
- filename exists
|
||||
}
|
||||
procedure Tloaddataform.editFilenameChange(Sender: TObject);
|
||||
begin
|
||||
btnImport.Enabled := (editFilename.Text <> '')
|
||||
and (chklistColumns.Items.Count > 0)
|
||||
and (FileExists(editFilename.Text));
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user