mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 00:19:15 +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;
|
||||
FOnChange: TNotifyEvent;
|
||||
FReadOnly: Boolean;
|
||||
function GetCaretPos: TPoint;
|
||||
function GetLeftTextMargin: Integer;
|
||||
function GetMultiLine: Boolean;
|
||||
function GetRightTextMargin: Integer;
|
||||
@ -207,6 +208,7 @@ type
|
||||
procedure DoDeleteSelection;
|
||||
procedure DoClearSelection;
|
||||
procedure DoManageVisibleTextStart;
|
||||
procedure SetCaretPost(AValue: TPoint);
|
||||
procedure SetLeftTextMargin(AValue: Integer);
|
||||
procedure SetLines(AValue: TStrings);
|
||||
procedure SetMultiLine(AValue: Boolean);
|
||||
@ -245,6 +247,7 @@ type
|
||||
function GetSelLength: Integer;
|
||||
procedure SetSelStartX(ANewX: Integer);
|
||||
procedure SetSelLength(ANewLength: Integer);
|
||||
property CaretPos: TPoint read GetCaretPos write SetCaretPost;
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
@ -1460,6 +1463,11 @@ begin
|
||||
Result := FEditState.LeftTextMargin;
|
||||
end;
|
||||
|
||||
function TCDEdit.GetCaretPos: TPoint;
|
||||
begin
|
||||
Result := FEditState.CaretPos;
|
||||
end;
|
||||
|
||||
function TCDEdit.GetMultiLine: Boolean;
|
||||
begin
|
||||
Result := FEditState.MultiLine;
|
||||
@ -1540,6 +1548,13 @@ begin
|
||||
FEditState.CaretPos.Y := Max(FEditState.CaretPos.Y, 0);
|
||||
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
|
||||
function TCDEdit.MousePosToCaretPos(X, Y: Integer): TPoint;
|
||||
var
|
||||
|
@ -190,13 +190,13 @@ type
|
||||
|
||||
// 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 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 SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
|
||||
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;}
|
||||
{ class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
|
||||
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;}
|
||||
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
|
||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
@ -1358,6 +1358,7 @@ begin
|
||||
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||
if lCDWinControl.CDControl = nil then Exit;
|
||||
TCDIntfEdit(lCDWinControl.CDControl).Lines.Text := AText;
|
||||
TCDIntfEdit(lCDWinControl.CDControl).Invalidate();
|
||||
end;
|
||||
|
||||
class procedure TCDWSCustomEdit.ShowHide(const AWinControl: TWinControl);
|
||||
@ -1381,23 +1382,19 @@ begin
|
||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetAlignment') then
|
||||
Exit;
|
||||
TQtLineEdit(ACustomEdit.Handle).setAlignment(AlignmentMap[AAlignment]);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
class function TCDWSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit
|
||||
): TPoint;
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
QtEdit: IQtEdit;
|
||||
lCDWinControl: TCDWinControl;
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
if not WSCheckHandleAllocated(ACustomEdit, 'GetCaretPos') then
|
||||
Exit;
|
||||
Widget := TQtWidget(ACustomEdit.Handle);
|
||||
if Supports(Widget, IQtEdit, QtEdit) then
|
||||
Result.X := QtEdit.getCursorPosition;
|
||||
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||
if lCDWinControl.CDControl = nil then Exit;
|
||||
Result := TCDIntfEdit(lCDWinControl.CDControl).CaretPos;
|
||||
end;
|
||||
|
||||
class function TCDWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit): Boolean;
|
||||
(*class function TCDWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit): Boolean;
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
QtEdit: IQtEdit;
|
||||
@ -1408,22 +1405,19 @@ begin
|
||||
Widget := TQtWidget(ACustomEdit.Handle);
|
||||
if Supports(Widget, IQtEdit, QtEdit) then
|
||||
Result := QtEdit.isUndoAvailable;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
class procedure TCDWSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit;
|
||||
const NewPos: TPoint);
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
QtEdit: IQtEdit;
|
||||
lCDWinControl: TCDWinControl;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetCaretPos') then
|
||||
Exit;
|
||||
Widget := TQtWidget(ACustomEdit.Handle);
|
||||
if Supports(Widget, IQtEdit, QtEdit) then
|
||||
QtEdit.setCursorPosition(NewPos.X);
|
||||
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||
if lCDWinControl.CDControl = nil then Exit;
|
||||
TCDIntfEdit(lCDWinControl.CDControl).CaretPos := NewPos;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
(*{------------------------------------------------------------------------------
|
||||
Method: TCDWSCustomEdit.SetEchoMode
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
@ -1465,7 +1459,7 @@ begin
|
||||
if NewLength <> MaxLength then
|
||||
QtEdit.setMaxLength(NewLength);
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWSCustomEdit.SetReadOnly
|
||||
@ -1474,16 +1468,12 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TCDWSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean);
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
QtEdit: IQtEdit;
|
||||
lCDWinControl: TCDWinControl;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ACustomEdit, 'SetReadOnly') then
|
||||
Exit;
|
||||
|
||||
Widget := TQtWidget(ACustomEdit.Handle);
|
||||
if Supports(Widget, IQtEdit, QtEdit) then
|
||||
QtEdit.setReadOnly(NewReadOnly);
|
||||
end;*)
|
||||
lCDWinControl := TCDWinControl(ACustomEdit.Handle);
|
||||
if lCDWinControl.CDControl = nil then Exit;
|
||||
TCDIntfEdit(lCDWinControl.CDControl).ReadOnly := NewReadOnly;
|
||||
end;
|
||||
|
||||
class function TCDWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user