mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #1577: make apphelpers.SelectNode more intelligent, returning true/false to indicate whether it successful went through OnFocusChanging event
This commit is contained in:
@ -367,7 +367,7 @@ var
|
||||
rx: TRegExpr;
|
||||
Prompt: TModalResult;
|
||||
ReplaceFlags: TReplaceFlags;
|
||||
FocusChangeAllowed: Boolean;
|
||||
NodeSelected: Boolean;
|
||||
begin
|
||||
// Data grid version of DoSearchReplaceText
|
||||
MainForm.ShowStatusMsg(_('Searching ...'));
|
||||
@ -388,7 +388,7 @@ begin
|
||||
ReplaceFlags := [rfReplaceAll];
|
||||
if not (ssoMatchCase in Options) then
|
||||
Include(ReplaceFlags, rfIgnoreCase);
|
||||
FocusChangeAllowed := True;
|
||||
NodeSelected := True;
|
||||
|
||||
// Init regular expression
|
||||
rx := TRegExpr.Create;
|
||||
@ -451,12 +451,9 @@ begin
|
||||
Inc(MatchCount);
|
||||
|
||||
// Set focus on node and column
|
||||
if (Node <> Grid.FocusedNode) and Assigned(Grid.OnFocusChanging) then begin
|
||||
Grid.OnFocusChanging(Grid, Grid.FocusedNode, Node, Grid.FocusedColumn, Column, FocusChangeAllowed);
|
||||
if not FocusChangeAllowed then
|
||||
Break;
|
||||
end;
|
||||
SelectNode(Grid, Node, False);
|
||||
NodeSelected := SelectNode(Grid, Node, False);
|
||||
if not NodeSelected then
|
||||
Break;
|
||||
Grid.FocusedColumn := Column;
|
||||
|
||||
// Replace logic
|
||||
@ -497,7 +494,7 @@ begin
|
||||
|
||||
if Match and (not (ssoReplaceAll in Options)) then
|
||||
Break;
|
||||
if not FocusChangeAllowed then
|
||||
if not NodeSelected then
|
||||
Break;
|
||||
|
||||
if Backwards then
|
||||
|
Reference in New Issue
Block a user