mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 00:40:18 +02:00
- TCustomMemo.WantReturns implementation (0008352)
git-svn-id: trunk@11124 -
This commit is contained in:
parent
99df3c959b
commit
3c6665616c
@ -30,6 +30,7 @@ constructor TCustomMemo.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
fCompStyle := csMemo;
|
fCompStyle := csMemo;
|
||||||
|
FWantReturns := true;
|
||||||
FWantTabs := false;
|
FWantTabs := false;
|
||||||
FWordWrap := True;
|
FWordWrap := True;
|
||||||
//FLines := TMemoStrings.Create(Self);
|
//FLines := TMemoStrings.Create(Self);
|
||||||
@ -93,6 +94,15 @@ begin
|
|||||||
FVertScrollBar:=AValue;
|
FVertScrollBar:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomMemo.SetWantReturns(const AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FWantReturns = AValue then
|
||||||
|
exit;
|
||||||
|
FWantReturns := AValue;
|
||||||
|
if HandleAllocated then
|
||||||
|
TWSCustomMemoClass(WidgetSetClass).SetWantReturns(Self, AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomMemo.StoreScrollBars: boolean;
|
function TCustomMemo.StoreScrollBars: boolean;
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -217,13 +227,27 @@ end;
|
|||||||
|
|
||||||
procedure TCustomMemo.ControlKeyDown(var Key: Word; Shift: TShiftState);
|
procedure TCustomMemo.ControlKeyDown(var Key: Word; Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
if not ReadOnly then begin
|
if not ReadOnly then
|
||||||
if (Key=VK_RETURN) and (Shift=[]) then exit;
|
begin
|
||||||
if FWantTabs and (Key=VK_TAB) and (Shift-[ssShift]=[]) then exit;
|
if FWantReturns and (Key=VK_RETURN) and (Shift=[]) then
|
||||||
|
exit;
|
||||||
|
if FWantTabs and (Key=VK_TAB) and (Shift-[ssShift]=[]) then
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
inherited ControlKeyDown(Key, Shift);
|
inherited ControlKeyDown(Key, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomMemo.CNChar(var Message: TLMKeyUp);
|
||||||
|
begin
|
||||||
|
inherited CNChar(Message);
|
||||||
|
|
||||||
|
if not FWantReturns and (Message.CharCode = VK_RETURN) then
|
||||||
|
begin
|
||||||
|
Message.CharCode := VK_UNKNOWN;
|
||||||
|
Message.Result := 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomMemo.SetWantTabs(const NewWantTabs: boolean);
|
procedure TCustomMemo.SetWantTabs(const NewWantTabs: boolean);
|
||||||
begin
|
begin
|
||||||
if FWantTabs = NewWantTabs then exit;
|
if FWantTabs = NewWantTabs then exit;
|
||||||
|
@ -723,6 +723,7 @@ type
|
|||||||
FLines: TStrings;
|
FLines: TStrings;
|
||||||
FScrollBars: TScrollStyle;
|
FScrollBars: TScrollStyle;
|
||||||
FVertScrollBar: TMemoScrollBar;
|
FVertScrollBar: TMemoScrollBar;
|
||||||
|
FWantReturns: Boolean;
|
||||||
FWantTabs: boolean;
|
FWantTabs: boolean;
|
||||||
FWordWrap: Boolean;
|
FWordWrap: Boolean;
|
||||||
procedure SetHorzScrollBar(const AValue: TMemoScrollBar);
|
procedure SetHorzScrollBar(const AValue: TMemoScrollBar);
|
||||||
@ -737,12 +738,14 @@ type
|
|||||||
procedure SetAlignment(const AValue: TAlignment);
|
procedure SetAlignment(const AValue: TAlignment);
|
||||||
procedure SetLines(const Value: TStrings);
|
procedure SetLines(const Value: TStrings);
|
||||||
procedure SetSelText(const Val: string); override;
|
procedure SetSelText(const Val: string); override;
|
||||||
|
procedure SetWantReturns(const AValue: Boolean);
|
||||||
procedure SetWantTabs(const NewWantTabs: boolean);
|
procedure SetWantTabs(const NewWantTabs: boolean);
|
||||||
procedure SetWordWrap(const Value: boolean);
|
procedure SetWordWrap(const Value: boolean);
|
||||||
procedure SetScrollBars(const Value: TScrollStyle);
|
procedure SetScrollBars(const Value: TScrollStyle);
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
function WordWrapIsStored: boolean; virtual;
|
function WordWrapIsStored: boolean; virtual;
|
||||||
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
|
procedure CNChar(var Message: TLMKeyUp); message CN_CHAR;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -756,7 +759,8 @@ type
|
|||||||
property VertScrollBar: TMemoScrollBar
|
property VertScrollBar: TMemoScrollBar
|
||||||
read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
|
read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
|
||||||
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars;
|
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars;
|
||||||
property WantTabs: boolean read FWantTabs write SetWantTabs default false;
|
property WantReturns: Boolean read FWantReturns write SetWantReturns default true;
|
||||||
|
property WantTabs: Boolean read FWantTabs write SetWantTabs default false;
|
||||||
property WordWrap: Boolean read FWordWrap write SetWordWrap stored WordWrapIsStored default true;
|
property WordWrap: Boolean read FWordWrap write SetWordWrap stored WordWrapIsStored default true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -853,6 +857,7 @@ type
|
|||||||
property TabOrder;
|
property TabOrder;
|
||||||
property TabStop;
|
property TabStop;
|
||||||
property Visible;
|
property Visible;
|
||||||
|
property WantReturns;
|
||||||
property WantTabs;
|
property WantTabs;
|
||||||
property WordWrap;
|
property WordWrap;
|
||||||
end;
|
end;
|
||||||
|
@ -146,6 +146,7 @@ type
|
|||||||
class procedure SetAlignment(const ACustomMemo: TCustomMemo; const AAlignment: TAlignment); virtual;
|
class procedure SetAlignment(const ACustomMemo: TCustomMemo; const AAlignment: TAlignment); virtual;
|
||||||
class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); virtual;
|
class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); virtual;
|
||||||
class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); virtual;
|
class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); virtual;
|
||||||
|
class procedure SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); virtual;
|
||||||
class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); virtual;
|
class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); virtual;
|
||||||
end;
|
end;
|
||||||
TWSCustomMemoClass = class of TWSCustomMemo;
|
TWSCustomMemoClass = class of TWSCustomMemo;
|
||||||
@ -419,6 +420,10 @@ class procedure TWSCustomMemo.SetWantTabs(const ACustomMemo: TCustomMemo; const
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TWSCustomMemo.SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
|
class procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user