mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Catch (TNT-)comboboxes in copy + paste actions. Fixes issue #1321
This commit is contained in:
@ -8700,6 +8700,7 @@ procedure TMainForm.actCopyOrCutExecute(Sender: TObject);
|
|||||||
var
|
var
|
||||||
Control: TWinControl;
|
Control: TWinControl;
|
||||||
Edit: TCustomEdit;
|
Edit: TCustomEdit;
|
||||||
|
Combo: TCustomComboBox;
|
||||||
Grid: TVirtualStringTree;
|
Grid: TVirtualStringTree;
|
||||||
SynMemo: TSynMemo;
|
SynMemo: TSynMemo;
|
||||||
Success, DoCut: Boolean;
|
Success, DoCut: Boolean;
|
||||||
@ -8717,6 +8718,13 @@ begin
|
|||||||
else Edit.CopyToClipboard;
|
else Edit.CopyToClipboard;
|
||||||
Success := True;
|
Success := True;
|
||||||
end;
|
end;
|
||||||
|
end else if Control is TCustomComboBox then begin
|
||||||
|
Combo := TCustomComboBox(Control);
|
||||||
|
if Combo.SelLength > 0 then begin
|
||||||
|
CopyToClipboard(Combo.SelText);
|
||||||
|
if DoCut then Combo.SelText := '';
|
||||||
|
Success := True;
|
||||||
|
end;
|
||||||
end else if Control is TVirtualStringTree then begin
|
end else if Control is TVirtualStringTree then begin
|
||||||
Grid := Control as TVirtualStringTree;
|
Grid := Control as TVirtualStringTree;
|
||||||
if Assigned(Grid.FocusedNode) then begin
|
if Assigned(Grid.FocusedNode) then begin
|
||||||
@ -8744,6 +8752,8 @@ procedure TMainForm.actPasteExecute(Sender: TObject);
|
|||||||
var
|
var
|
||||||
Control: TWinControl;
|
Control: TWinControl;
|
||||||
Edit: TCustomEdit;
|
Edit: TCustomEdit;
|
||||||
|
Combo: TComboBox;
|
||||||
|
TNTCombo: TTNTComboBox;
|
||||||
Grid: TVirtualStringTree;
|
Grid: TVirtualStringTree;
|
||||||
SynMemo: TSynMemo;
|
SynMemo: TSynMemo;
|
||||||
Success: Boolean;
|
Success: Boolean;
|
||||||
@ -8752,6 +8762,7 @@ begin
|
|||||||
// Paste text into the focused control
|
// Paste text into the focused control
|
||||||
Success := False;
|
Success := False;
|
||||||
Control := Screen.ActiveControl;
|
Control := Screen.ActiveControl;
|
||||||
|
CB := TUniClipboard.Create;
|
||||||
// Do not handle Search/replace dialog
|
// Do not handle Search/replace dialog
|
||||||
if not Control.Focused then Exit;
|
if not Control.Focused then Exit;
|
||||||
if not Clipboard.HasFormat(CF_TEXT) then begin
|
if not Clipboard.HasFormat(CF_TEXT) then begin
|
||||||
@ -8762,10 +8773,21 @@ begin
|
|||||||
Edit.PasteFromClipboard;
|
Edit.PasteFromClipboard;
|
||||||
Success := True;
|
Success := True;
|
||||||
end;
|
end;
|
||||||
|
end else if Control is TComboBox then begin
|
||||||
|
Combo := TComboBox(Control);
|
||||||
|
if Combo.Style = csDropDown then begin
|
||||||
|
Combo.SelText := CB.AsWideString;
|
||||||
|
Success := True;
|
||||||
|
end;
|
||||||
|
end else if Control is TTNTComboBox then begin
|
||||||
|
TNTCombo := TTNTComboBox(Control);
|
||||||
|
if TNTCombo.Style = csDropDown then begin
|
||||||
|
TNTCombo.SelText := CB.AsWideString;
|
||||||
|
Success := True;
|
||||||
|
end;
|
||||||
end else if Control is TVirtualStringTree then begin
|
end else if Control is TVirtualStringTree then begin
|
||||||
Grid := Control as TVirtualStringTree;
|
Grid := Control as TVirtualStringTree;
|
||||||
if Assigned(Grid.FocusedNode) and (Grid = ActiveGrid) then begin
|
if Assigned(Grid.FocusedNode) and (Grid = ActiveGrid) then begin
|
||||||
CB := TUniClipboard.Create;
|
|
||||||
Grid.Text[Grid.FocusedNode, Grid.FocusedColumn] := CB.AsWideString;
|
Grid.Text[Grid.FocusedNode, Grid.FocusedColumn] := CB.AsWideString;
|
||||||
Success := True;
|
Success := True;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user