Display focused row and column number of active grid in status bar

This commit is contained in:
Ansgar Becker
2010-03-08 07:10:49 +00:00
parent 65d0b59eba
commit 31db8b4b61
2 changed files with 34 additions and 7 deletions

View File

@ -1248,6 +1248,7 @@ object MainForm: TMainForm
OnEditing = DataGridEditing
OnEnter = ValidateControls
OnExit = ValidateControls
OnFocusChanged = DataGridFocusChanged
OnFocusChanging = DataGridFocusChanging
OnGetText = AnyGridGetText
OnPaintText = AnyGridPaintText

View File

@ -780,6 +780,7 @@ type
procedure DatabaseChanged(Database: String);
function GetBlobContent(Results: TMySQLQuery; Column: Integer): String;
procedure DoSearchReplace;
procedure UpdateLineCharPanel;
public
Connection: TMySQLConnection;
SessionName: String;
@ -3873,9 +3874,7 @@ begin
if QueryTabActive then RefreshQueryHelpers;
ValidateQueryControls(Sender);
if not QueryTabActive then // Empty panel with "Line:Char"
showstatus('', 1);
UpdateLineCharPanel;
end;
procedure TMainForm.RefreshQueryHelpers;
@ -4335,12 +4334,9 @@ end;
procedure TMainForm.SynMemoQueryStatusChange(Sender: TObject; Changes:
TSynStatusChanges);
var
sm: TSynMemo;
begin
sm := Sender as TSynMemo;
ValidateQueryControls(Sender);
showstatus(FormatNumber(sm.CaretY)+' : '+FormatNumber(sm.CaretX), 1);
UpdateLineCharPanel;
end;
@ -6924,6 +6920,13 @@ begin
end;
procedure TMainForm.DataGridFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex);
begin
UpdateLineCharPanel;
end;
{**
DataGrid: invoke update or insert routine
}
@ -9187,5 +9190,28 @@ begin
end;
procedure TMainForm.UpdateLineCharPanel;
var
x, y: Int64;
Grid: TVirtualStringTree;
begin
// Fill panel with "Line:Char"
x := -1;
y := -1;
Grid := ActiveGrid;
if Assigned(Grid) and Grid.Focused then begin
if Assigned(Grid.FocusedNode) then
y := Grid.FocusedNode.Index+1;
x := Grid.FocusedColumn+1;
end else if QueryTabActive and ActiveQueryMemo.Focused then begin
x := ActiveQueryMemo.CaretX;
y := ActiveQueryMemo.CaretY;
end;
if (x > -1) and (y > -1) then
ShowStatus(FormatNumber(y)+' : '+FormatNumber(x), 1)
else
ShowStatus('', 1);
end;
end.