mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-18 22:44:29 +01:00
add wanttabs property to tcustommemo to disable grabbing of tab key; compatibility (issue #1811)
git-svn-id: trunk@9570 -
This commit is contained in:
parent
835c420a89
commit
dc66dedc3b
@ -30,6 +30,7 @@ constructor TCustomMemo.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csMemo;
|
||||
FWantTabs := false;
|
||||
FWordWrap := True;
|
||||
//FLines := TMemoStrings.Create(Self);
|
||||
FLines := TStringList.Create; //TODO finish TTextStrings and add them here instead of TStringList
|
||||
@ -198,11 +199,19 @@ procedure TCustomMemo.ControlKeyDown(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
if not ReadOnly then begin
|
||||
if (Key=VK_RETURN) and (Shift=[]) then exit;
|
||||
if (Key=VK_TAB) and (Shift-[ssShift]=[]) then exit;
|
||||
if FWantTabs and (Key=VK_TAB) and (Shift-[ssShift]=[]) then exit;
|
||||
end;
|
||||
inherited ControlKeyDown(Key, Shift);
|
||||
end;
|
||||
|
||||
procedure TCustomMemo.SetWantTabs(const NewWantTabs: boolean);
|
||||
begin
|
||||
if FWantTabs = NewWantTabs then exit;
|
||||
FWantTabs := NewWantTabs;
|
||||
if HandleAllocated then
|
||||
TWSCustomMemoClass(WidgetSetClass).SetWantTabs(Self, NewWantTabs);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomMemo.SetWordWrap
|
||||
Params:
|
||||
|
||||
@ -677,6 +677,7 @@ type
|
||||
FLines: TStrings;
|
||||
FScrollBars: TScrollStyle;
|
||||
FVertScrollBar: TMemoScrollBar;
|
||||
FWantTabs: boolean;
|
||||
FWordWrap: Boolean;
|
||||
procedure SetHorzScrollBar(const AValue: TMemoScrollBar);
|
||||
procedure SetVertScrollBar(const AValue: TMemoScrollBar);
|
||||
@ -688,11 +689,14 @@ type
|
||||
procedure RealSetText(const Value: TCaption); override;
|
||||
function GetCachedText(var CachedText: TCaption): boolean; override;
|
||||
procedure SetLines(const Value: TStrings);
|
||||
procedure SetWantTabs(const NewWantTabs: boolean);
|
||||
procedure SetWordWrap(const Value: boolean);
|
||||
procedure SetScrollBars(const Value: TScrollStyle);
|
||||
procedure Loaded; override;
|
||||
function WordWrapIsStored: boolean; virtual;
|
||||
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
|
||||
property WantTabs: boolean read FWantTabs write SetWantTabs default false;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -782,6 +786,7 @@ type
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property Visible;
|
||||
property WantTabs;
|
||||
property WordWrap;
|
||||
end;
|
||||
|
||||
|
||||
@ -139,6 +139,7 @@ type
|
||||
class procedure AppendText(const ACustomMemo: TCustomMemo; const AText: string); virtual;
|
||||
class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; virtual;
|
||||
class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); virtual;
|
||||
class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); virtual;
|
||||
class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); virtual;
|
||||
end;
|
||||
TWSCustomMemoClass = class of TWSCustomMemo;
|
||||
@ -389,6 +390,10 @@ class procedure TWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo; cons
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSCustomMemo.SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
|
||||
begin
|
||||
end;
|
||||
@ -441,4 +446,4 @@ initialization
|
||||
// RegisterWSComponent(TRadioButton, TWSRadioButton);
|
||||
// RegisterWSComponent(TLabel, TWSLabel);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user