mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 04:39:24 +02:00
LCL-CustomDrawn: Improves TEdit features support so that now we can already read data from a database with TDBEdit
git-svn-id: trunk@39473 -
This commit is contained in:
parent
7044190d31
commit
ceaecc704b
@ -200,6 +200,7 @@ type
|
|||||||
FLines: TStrings;
|
FLines: TStrings;
|
||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
FReadOnly: Boolean;
|
FReadOnly: Boolean;
|
||||||
|
function GetCaretPos: TPoint;
|
||||||
function GetLeftTextMargin: Integer;
|
function GetLeftTextMargin: Integer;
|
||||||
function GetMultiLine: Boolean;
|
function GetMultiLine: Boolean;
|
||||||
function GetRightTextMargin: Integer;
|
function GetRightTextMargin: Integer;
|
||||||
@ -207,6 +208,7 @@ type
|
|||||||
procedure DoDeleteSelection;
|
procedure DoDeleteSelection;
|
||||||
procedure DoClearSelection;
|
procedure DoClearSelection;
|
||||||
procedure DoManageVisibleTextStart;
|
procedure DoManageVisibleTextStart;
|
||||||
|
procedure SetCaretPost(AValue: TPoint);
|
||||||
procedure SetLeftTextMargin(AValue: Integer);
|
procedure SetLeftTextMargin(AValue: Integer);
|
||||||
procedure SetLines(AValue: TStrings);
|
procedure SetLines(AValue: TStrings);
|
||||||
procedure SetMultiLine(AValue: Boolean);
|
procedure SetMultiLine(AValue: Boolean);
|
||||||
@ -245,6 +247,7 @@ type
|
|||||||
function GetSelLength: Integer;
|
function GetSelLength: Integer;
|
||||||
procedure SetSelStartX(ANewX: Integer);
|
procedure SetSelStartX(ANewX: Integer);
|
||||||
procedure SetSelLength(ANewLength: Integer);
|
procedure SetSelLength(ANewLength: Integer);
|
||||||
|
property CaretPos: TPoint read GetCaretPos write SetCaretPost;
|
||||||
published
|
published
|
||||||
property Align;
|
property Align;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
@ -1460,6 +1463,11 @@ begin
|
|||||||
Result := FEditState.LeftTextMargin;
|
Result := FEditState.LeftTextMargin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDEdit.GetCaretPos: TPoint;
|
||||||
|
begin
|
||||||
|
Result := FEditState.CaretPos;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCDEdit.GetMultiLine: Boolean;
|
function TCDEdit.GetMultiLine: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FEditState.MultiLine;
|
Result := FEditState.MultiLine;
|
||||||
@ -1540,6 +1548,13 @@ begin
|
|||||||
FEditState.CaretPos.Y := Max(FEditState.CaretPos.Y, 0);
|
FEditState.CaretPos.Y := Max(FEditState.CaretPos.Y, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCDEdit.SetCaretPost(AValue: TPoint);
|
||||||
|
begin
|
||||||
|
FEditState.CaretPos.X := AValue.X;
|
||||||
|
FEditState.CaretPos.Y := AValue.Y;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
// Result.X -> returns a zero-based position of the caret
|
// Result.X -> returns a zero-based position of the caret
|
||||||
function TCDEdit.MousePosToCaretPos(X, Y: Integer): TPoint;
|
function TCDEdit.MousePosToCaretPos(X, Y: Integer): TPoint;
|
||||||
var
|
var
|
||||||
|
@ -190,13 +190,13 @@ type
|
|||||||
|
|
||||||
// TWSCustomEdit
|
// TWSCustomEdit
|
||||||
|
|
||||||
{ class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); override;
|
// class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); override;
|
||||||
class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; override;
|
class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; override;
|
||||||
class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; override;
|
// class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; override;
|
||||||
class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); override;
|
class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); override;
|
||||||
class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
|
{ class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
|
||||||
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;}
|
||||||
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;}
|
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
|
||||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
||||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||||
@ -1358,6 +1358,7 @@ begin
|
|||||||
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||||
if lCDWinControl.CDControl = nil then Exit;
|
if lCDWinControl.CDControl = nil then Exit;
|
||||||
TCDIntfEdit(lCDWinControl.CDControl).Lines.Text := AText;
|
TCDIntfEdit(lCDWinControl.CDControl).Lines.Text := AText;
|
||||||
|
TCDIntfEdit(lCDWinControl.CDControl).Invalidate();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSCustomEdit.ShowHide(const AWinControl: TWinControl);
|
class procedure TCDWSCustomEdit.ShowHide(const AWinControl: TWinControl);
|
||||||
@ -1381,23 +1382,19 @@ begin
|
|||||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetAlignment') then
|
if not WSCheckHandleAllocated(ACustomEdit, 'SetAlignment') then
|
||||||
Exit;
|
Exit;
|
||||||
TQtLineEdit(ACustomEdit.Handle).setAlignment(AlignmentMap[AAlignment]);
|
TQtLineEdit(ACustomEdit.Handle).setAlignment(AlignmentMap[AAlignment]);
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
class function TCDWSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit
|
class function TCDWSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit
|
||||||
): TPoint;
|
): TPoint;
|
||||||
var
|
var
|
||||||
Widget: TQtWidget;
|
lCDWinControl: TCDWinControl;
|
||||||
QtEdit: IQtEdit;
|
|
||||||
begin
|
begin
|
||||||
Result := Point(0,0);
|
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||||
if not WSCheckHandleAllocated(ACustomEdit, 'GetCaretPos') then
|
if lCDWinControl.CDControl = nil then Exit;
|
||||||
Exit;
|
Result := TCDIntfEdit(lCDWinControl.CDControl).CaretPos;
|
||||||
Widget := TQtWidget(ACustomEdit.Handle);
|
|
||||||
if Supports(Widget, IQtEdit, QtEdit) then
|
|
||||||
Result.X := QtEdit.getCursorPosition;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCDWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit): Boolean;
|
(*class function TCDWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit): Boolean;
|
||||||
var
|
var
|
||||||
Widget: TQtWidget;
|
Widget: TQtWidget;
|
||||||
QtEdit: IQtEdit;
|
QtEdit: IQtEdit;
|
||||||
@ -1408,22 +1405,19 @@ begin
|
|||||||
Widget := TQtWidget(ACustomEdit.Handle);
|
Widget := TQtWidget(ACustomEdit.Handle);
|
||||||
if Supports(Widget, IQtEdit, QtEdit) then
|
if Supports(Widget, IQtEdit, QtEdit) then
|
||||||
Result := QtEdit.isUndoAvailable;
|
Result := QtEdit.isUndoAvailable;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
class procedure TCDWSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit;
|
class procedure TCDWSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit;
|
||||||
const NewPos: TPoint);
|
const NewPos: TPoint);
|
||||||
var
|
var
|
||||||
Widget: TQtWidget;
|
lCDWinControl: TCDWinControl;
|
||||||
QtEdit: IQtEdit;
|
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetCaretPos') then
|
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||||
Exit;
|
if lCDWinControl.CDControl = nil then Exit;
|
||||||
Widget := TQtWidget(ACustomEdit.Handle);
|
TCDIntfEdit(lCDWinControl.CDControl).CaretPos := NewPos;
|
||||||
if Supports(Widget, IQtEdit, QtEdit) then
|
|
||||||
QtEdit.setCursorPosition(NewPos.X);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
(*{------------------------------------------------------------------------------
|
||||||
Method: TCDWSCustomEdit.SetEchoMode
|
Method: TCDWSCustomEdit.SetEchoMode
|
||||||
Params: None
|
Params: None
|
||||||
Returns: Nothing
|
Returns: Nothing
|
||||||
@ -1465,7 +1459,7 @@ begin
|
|||||||
if NewLength <> MaxLength then
|
if NewLength <> MaxLength then
|
||||||
QtEdit.setMaxLength(NewLength);
|
QtEdit.setMaxLength(NewLength);
|
||||||
end;
|
end;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCDWSCustomEdit.SetReadOnly
|
Method: TCDWSCustomEdit.SetReadOnly
|
||||||
@ -1474,16 +1468,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TCDWSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean);
|
class procedure TCDWSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean);
|
||||||
var
|
var
|
||||||
Widget: TQtWidget;
|
lCDWinControl: TCDWinControl;
|
||||||
QtEdit: IQtEdit;
|
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetReadOnly') then
|
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||||
Exit;
|
if lCDWinControl.CDControl = nil then Exit;
|
||||||
|
TCDIntfEdit(lCDWinControl.CDControl).ReadOnly := NewReadOnly;
|
||||||
Widget := TQtWidget(ACustomEdit.Handle);
|
end;
|
||||||
if Supports(Widget, IQtEdit, QtEdit) then
|
|
||||||
QtEdit.setReadOnly(NewReadOnly);
|
|
||||||
end;*)
|
|
||||||
|
|
||||||
class function TCDWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
class function TCDWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user