richmemo: CharAtPos method

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4086 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2015-04-19 03:25:43 +00:00
parent 1507632a55
commit 8d29dccb15
3 changed files with 33 additions and 0 deletions

View File

@ -251,6 +251,8 @@ type
function Print(const params: TPrintParams): Integer;
function CharAtPos(x, y: Integer): Integer;
property HideSelection : Boolean read fHideSelection write SetHideSelection;
property OnSelectionChange: TNotifyEvent read fOnSelectionChange write fOnSelectionChange;
property ZoomFactor: Double read GetZoomFactor write SetZoomFactor;
@ -1027,6 +1029,14 @@ begin
Result:=TWSCustomRichMemoClass(WidgetSetClass).Print(Self, Printer, params, true);
end;
function TCustomRichMemo.CharAtPos(x, y: Integer): Integer;
begin
if HandleAllocated then
Result:=TWSCustomRichMemoClass(WidgetSetClass).CharAtPos(Self, x, y)
else
Result:=-1;
end;
function TCustomRichMemo.PrintMeasure(const params: TPrintParams; var est: TPrintMeasure): Boolean;
begin
if not Assigned(Printer) then begin

View File

@ -108,6 +108,7 @@ type
class procedure InDelText(const AWinControl: TWinControl; const TextUTF8: String; DstStart, DstLen: Integer); override;
class function GetSubText(const AWinControl: TWinControl; TextStart, TextLen: Integer;
AsUnicode: Boolean; var isUnicode: Boolean; var txt: string; var utxt: UnicodeString): Boolean; override;
class function CharAtPos(const AWinControl: TWinControl; x,y: Integer): Integer; override;
class function Search(const AWinControl: TWinControl; const ANiddle: string;
const SearchOpts: TIntSearchOpt): Integer; override;
@ -986,6 +987,20 @@ begin
RichEditManager.SetEventMask(Hnd, eventmask);
end;
class function TWin32WSCustomRichMemo.CharAtPos(const AWinControl: TWinControl;
x, y: Integer): Integer;
var
p : POINTL;
begin
if not Assigned(AWinControl) then
inherited
else begin
p.x:=x;
p.y:=y;
Result:=Windows.SendMessage(AWinControl.Handle, EM_CHARFROMPOS, 0, LPARAM(@p));
end;
end;
class function TWin32WSCustomRichMemo.Search(const AWinControl: TWinControl;
const ANiddle: string; const SearchOpts: TIntSearchOpt): Integer;
begin

View File

@ -88,6 +88,8 @@ type
class function GetSubText(const AWinControl: TWinControl; TextStart, TextLen: Integer;
AsUnicode: Boolean; var isUnicode: Boolean; var txt: string; var utxt: UnicodeString): Boolean; virtual;
class function CharAtPos(const AWinControl: TWinControl; x,y: Integer): Integer; virtual;
//class procedure SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean); override;
class function LoadRichText(const AWinControl: TWinControl; Source: TStream): Boolean; virtual;
class function SaveRichText(const AWinControl: TWinControl; Dest: TStream): Boolean; virtual;
@ -244,6 +246,12 @@ begin
Result:=true;
end;
class function TWSCustomRichMemo.CharAtPos(const AWinControl: TWinControl; x,
y: Integer): Integer;
begin
Result:=-1;
end;
{class procedure TWSCustomRichMemo.SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean);
begin