views:

289

answers:

1
+4  A: 

There is EM_GETMARGINS. I'm not sure if that counts as "simple". :-)

EDIT: Try this:

type
  tSynMargins = record
    left, right: Word;
  end;

function GetLeftMargin(hEdit: HWND): Word;
var
  margins: Longint;
begin
  margins := SendMessage(hEdit, EM_GETMARGINS, 0, 0);
  Result := tsynMargins(Margins).left;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := IntToStr(GetLeftMargin(Edit1.Handle));
  Memo1.Text := IntToStr(GetLeftMargin(Memo1.Handle));
end;

(inspired by this)

Ulrich Gerhardt
Great, thanks. EM_SETMARGINS also works well!
frogb