What does?
procedure TEditorDlg.UpdateStatusPanel;
var
CaretPos : DWord;
Hand : THandle;
begin
if KeyStatus.NumLock = ksOn
THEN StatusBar.Panels[3].Text := 'NUM'
ELSE StatusBar.Panels[3].Text := '';
if KeyStatus.CapsLock = ksOn
THEN StatusBar.Panels[4].Text := 'CAP'
ELSE StatusBar.Panels[4].Text := '';
SendMessage(EditGrid.Handle, EM_GETSEL, 0, CaretPos);
StatusBar.Panels[0].Text := IntToStr(CaretPos);
StatusBar.Panels[1].Text := IntToStr(EditGrid.Selection.Top-1);
end;
Christopher,
if EditGrid is a TStringgrid then the message is send to the wrong window.
In edit mode the grid uses a special edit control that moves from cell to
cell as the user moves the focus. That control needs to be the target of
the message if you want its caret position. TStringgrid inherits a
protected property
property InplaceEditor: TInplaceEdit read FInplaceEdit;
from TCustomGrid. You can get its handle via
Type
TGridCracker = Class( TStringGrid );
SendMessage(TGridCracker(EditGrid).InplaceEditor.Handle, EM_GETSEL, 0,
CaretPos);
Wouldn't it make more sense to display the current Row/Col in the grid
instead of the caret position in the editor control?
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitely requested!
Thank you very much for the answer - I was befuddled by this one...
As for your second point - actually no, I am making a COBOL editing program and as you may know - columns are pretty
important in COBOL - I am using the TStringGrid as the editor because COBOL starts code out at column 7 and I just
wanted to show the line numbers at the left...
Ordinarily I think it most certainly would make more sense.