mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 23:39:08 +02:00
LCL-CustomDrawn: Implements SetFocus and corrects a lot of control injection code which was not updated to the latest way of doing it
git-svn-id: trunk@37048 -
This commit is contained in:
parent
8da0ccb743
commit
a294a8baf8
@ -77,4 +77,5 @@
|
|||||||
{.$define VerboseCDEvents}
|
{.$define VerboseCDEvents}
|
||||||
{.$define VerboseCDAccessibility}
|
{.$define VerboseCDAccessibility}
|
||||||
{.$define VerboseCDClipboard}
|
{.$define VerboseCDClipboard}
|
||||||
|
{.$define VerboseCDFocus}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ type
|
|||||||
function AdjustCoordinatesForScrolling(AX, AY: Integer): TPoint;
|
function AdjustCoordinatesForScrolling(AX, AY: Integer): TPoint;
|
||||||
procedure UpdateImageAndCanvas; virtual;
|
procedure UpdateImageAndCanvas; virtual;
|
||||||
function IsControlBackgroundVisible: Boolean; virtual;
|
function IsControlBackgroundVisible: Boolean; virtual;
|
||||||
|
function GetWinControl: TWinControl; virtual;
|
||||||
property Props[AnIndex:String]:pointer read GetProps write SetProps;
|
property Props[AnIndex:String]:pointer read GetProps write SetProps;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ type
|
|||||||
CDControlInjected: Boolean;
|
CDControlInjected: Boolean;
|
||||||
procedure UpdateImageAndCanvas; override;
|
procedure UpdateImageAndCanvas; override;
|
||||||
function IsControlBackgroundVisible: Boolean; override;
|
function IsControlBackgroundVisible: Boolean; override;
|
||||||
|
function GetWinControl: TWinControl; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCDForm }
|
{ TCDForm }
|
||||||
@ -90,6 +92,7 @@ type
|
|||||||
procedure SanityCheckScrollPos();
|
procedure SanityCheckScrollPos();
|
||||||
procedure UpdateImageAndCanvas; override;
|
procedure UpdateImageAndCanvas; override;
|
||||||
function IsControlBackgroundVisible: Boolean; override;
|
function IsControlBackgroundVisible: Boolean; override;
|
||||||
|
function GetWinControl: TWinControl; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCDNonNativeForm = class(TCDForm)
|
TCDNonNativeForm = class(TCDForm)
|
||||||
@ -974,6 +977,11 @@ begin
|
|||||||
Result:=inherited IsControlBackgroundVisible;
|
Result:=inherited IsControlBackgroundVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDWinControl.GetWinControl: TWinControl;
|
||||||
|
begin
|
||||||
|
Result := WinControl;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCDBitmap }
|
{ TCDBitmap }
|
||||||
|
|
||||||
destructor TCDBitmap.Destroy;
|
destructor TCDBitmap.Destroy;
|
||||||
@ -997,6 +1005,11 @@ begin
|
|||||||
result := nil;
|
result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDBaseControl.GetWinControl: TWinControl;
|
||||||
|
begin
|
||||||
|
Result := FWinControl;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCDBaseControl.SetProps(AnIndex: String; AValue: pointer);
|
procedure TCDBaseControl.SetProps(AnIndex: String; AValue: pointer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -1130,5 +1143,10 @@ begin
|
|||||||
Result:=inherited IsControlBackgroundVisible;
|
Result:=inherited IsControlBackgroundVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDForm.GetWinControl: TWinControl;
|
||||||
|
begin
|
||||||
|
Result := LCLForm;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -4701,6 +4701,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
lControlHandle := TCDWinControl(lHandle);
|
lControlHandle := TCDWinControl(lHandle);
|
||||||
lControlHandle.IncInvalidateCount();
|
lControlHandle.IncInvalidateCount();
|
||||||
|
if lControlHandle.CDControlInjected and (lControlHandle.CDControl <> nil) then
|
||||||
|
TCDWinControl(lControlHandle.CDControl.Handle).IncInvalidateCount();
|
||||||
lControl := lControlHandle.WinControl;
|
lControl := lControlHandle.WinControl;
|
||||||
lControl := Forms.GetParentForm(lControl);
|
lControl := Forms.GetParentForm(lControl);
|
||||||
// Don't use Rect in BackendInvalidateRect unless we really make the full
|
// Don't use Rect in BackendInvalidateRect unless we really make the full
|
||||||
@ -5556,7 +5558,7 @@ begin
|
|||||||
QCursor_setPos(X, Y);
|
QCursor_setPos(X, Y);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: SetFocus
|
Function: SetFocus
|
||||||
@ -5564,29 +5566,67 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.SetFocus(hWnd: HWND): HWND;
|
function TCDWidgetSet.SetFocus(hWnd: HWND): HWND;
|
||||||
var
|
var
|
||||||
W: TQtWidget;
|
lObject, lOldObject: TCDBaseControl;
|
||||||
|
lOldControl: TWinControl;
|
||||||
|
lHandle: TCDWinControl;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef VerboseCDFocus}
|
||||||
|
DebugLn(Format('[TCDWidgetSet.SetFocus] Handle=%x', [hWnd]));
|
||||||
|
{$endif}
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if hwnd<>0 then
|
if hwnd = 0 then
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseFocus}
|
Result := GetFocus();
|
||||||
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
Exit;
|
||||||
{$endif}
|
end;
|
||||||
Result := GetFocus;
|
lObject := TCDBaseControl(hWnd);
|
||||||
W := TQtWidget(HWND).getWindow;
|
|
||||||
if (W <> nil) and W.getVisible and not W.IsActiveWindow and
|
// SetFocus on a child control
|
||||||
not TQtMainWindow(W).Blocked then
|
if lObject is TCDWinControl then
|
||||||
W.Activate;
|
begin
|
||||||
TQtWidget(hWnd).setFocus;
|
lHandle := TCDWinControl(lObject);
|
||||||
{$ifdef VerboseFocus}
|
// If the control is injected, really set focus in the injected one
|
||||||
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
if lHandle.CDControlInjected and (lHandle.CDControl <> nil) then
|
||||||
|
begin
|
||||||
|
Result := SetFocus(LCLType.HWND(lHandle.CDControl.Handle));
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Handling for controls without injected controls
|
||||||
|
Result := GetFocus();
|
||||||
|
lOldObject := TCDBaseControl(Result);
|
||||||
|
if lOldObject = nil then
|
||||||
|
lOldControl := nil
|
||||||
|
else
|
||||||
|
lOldControl := lOldObject.GetWinControl();
|
||||||
|
|
||||||
|
if lOldControl <> nil then
|
||||||
|
LCLSendKillFocusMsg(lOldControl);
|
||||||
|
LCLSendSetFocusMsg(lHandle.WinControl);
|
||||||
|
FocusedControl := lHandle.WinControl;
|
||||||
|
FocusedIntfControl := lHandle.CDControl;
|
||||||
|
{$ifdef VerboseCDFocus}
|
||||||
|
DebugLn(Format(':[TCDWidgetSet.SetFocus] NewFocusedControl=%s NewFocusedIntfControl=%x', [FocusedControl.Name, PtrUInt(FocusedIntfControl)]));
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
// Set focus in the parent window
|
||||||
|
//Result := BackendSetFocus(hWnd);
|
||||||
|
|
||||||
|
// Invalidate to redraw the new control
|
||||||
|
InvalidateRect(LCLType.HWND(lHandle), nil, True);
|
||||||
|
if lOldObject <> nil then
|
||||||
|
InvalidateRect(LCLType.HWND(lOldObject), nil, True);
|
||||||
|
end
|
||||||
|
// SetFocus on a form
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result := BackendSetFocus(hWnd);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtWidgetSet.GetForegroundWindow: HWND;
|
(*function TQtWidgetSet.GetForegroundWindow: HWND;
|
||||||
var
|
var
|
||||||
W: QWidgetH;
|
W: QWidgetH;
|
||||||
begin
|
begin
|
||||||
|
@ -5524,7 +5524,7 @@ begin
|
|||||||
QCursor_setPos(X, Y);
|
QCursor_setPos(X, Y);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: SetFocus
|
Function: SetFocus
|
||||||
@ -5532,12 +5532,12 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.SetFocus(hWnd: HWND): HWND;
|
function TCDWidgetSet.BackendSetFocus(hWnd: HWND): HWND;
|
||||||
var
|
{var
|
||||||
W: TQtWidget;
|
W: TQtWidget;}
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if hwnd<>0 then
|
(* if hwnd<>0 then
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseFocus}
|
{$ifdef VerboseFocus}
|
||||||
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
||||||
@ -5551,10 +5551,10 @@ begin
|
|||||||
{$ifdef VerboseFocus}
|
{$ifdef VerboseFocus}
|
||||||
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;*)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtWidgetSet.GetForegroundWindow: HWND;
|
(*function TQtWidgetSet.GetForegroundWindow: HWND;
|
||||||
var
|
var
|
||||||
W: QWidgetH;
|
W: QWidgetH;
|
||||||
begin
|
begin
|
||||||
|
@ -846,9 +846,20 @@ begin
|
|||||||
{$IFDEF VerboseWinAPI}
|
{$IFDEF VerboseWinAPI}
|
||||||
DebugLn(Format('TCocoaWidgetSet.SelectObject Result: %x', [Result]));
|
DebugLn(Format('TCocoaWidgetSet.SelectObject Result: %x', [Result]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Function: SetFocus
|
||||||
|
Params: hWnd - Window handle to be focused
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCDWidgetSet.BackendSetFocus(hWnd: HWND): HWND;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
(*{------------------------------------------------------------------------------
|
||||||
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean;
|
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean;
|
||||||
|
|
||||||
nCmdShow:
|
nCmdShow:
|
||||||
|
@ -3148,7 +3148,7 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
Windows.SetCursorPos(X, Y);
|
Windows.SetCursorPos(X, Y);
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: SetFocus
|
Method: SetFocus
|
||||||
@ -3157,19 +3157,22 @@ end;
|
|||||||
|
|
||||||
The SetFocus function sets the keyboard focus to the specified window
|
The SetFocus function sets the keyboard focus to the specified window
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWin32WidgetSet.SetFocus(HWnd: HWND): HWND;
|
function TCDWidgetSet.BackendSetFocus(HWnd: HWND): HWND;
|
||||||
|
var
|
||||||
|
lWindowInfo: TWindowInfo;
|
||||||
|
lHandle: HWND;
|
||||||
begin
|
begin
|
||||||
{
|
if HWND = 0 then
|
||||||
if Windows.GetFocus <> HWnd then
|
|
||||||
begin
|
begin
|
||||||
DebugLn(['TWin32WidgetSet.SetFocus ', ' Wnd = ', WndClassName(HWnd), ' LCLObject = ', dbgsName(GetLCLOwnerObject(HWnd))]);
|
Result := GetFocus();
|
||||||
DumpStack;
|
Exit;
|
||||||
end;
|
end;
|
||||||
}
|
lWindowInfo := TWindowInfo(HWnd);
|
||||||
Result := Windows.SetFocus(HWnd);
|
lHandle := lWindowInfo.NativeHandle;
|
||||||
|
Result := Windows.SetFocus(lHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
(*{------------------------------------------------------------------------------
|
||||||
Method: SetForegroundWindow
|
Method: SetForegroundWindow
|
||||||
Params: HWnd - The handle of the window
|
Params: HWnd - The handle of the window
|
||||||
Returns: True if succesful
|
Returns: True if succesful
|
||||||
|
@ -5510,7 +5510,7 @@ begin
|
|||||||
QCursor_setPos(X, Y);
|
QCursor_setPos(X, Y);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: SetFocus
|
Function: SetFocus
|
||||||
@ -5518,29 +5518,12 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.SetFocus(hWnd: HWND): HWND;
|
function TCDWidgetSet.BackendSetFocus(hWnd: HWND): HWND;
|
||||||
var
|
|
||||||
W: TQtWidget;
|
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if hwnd<>0 then
|
|
||||||
begin
|
|
||||||
{$ifdef VerboseFocus}
|
|
||||||
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
|
||||||
{$endif}
|
|
||||||
Result := GetFocus;
|
|
||||||
W := TQtWidget(HWND).getWindow;
|
|
||||||
if (W <> nil) and W.getVisible and not W.IsActiveWindow and
|
|
||||||
not TQtMainWindow(W).Blocked then
|
|
||||||
W.Activate;
|
|
||||||
TQtWidget(hWnd).setFocus;
|
|
||||||
{$ifdef VerboseFocus}
|
|
||||||
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
|
||||||
{$endif}
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtWidgetSet.GetForegroundWindow: HWND;
|
(*function TQtWidgetSet.GetForegroundWindow: HWND;
|
||||||
var
|
var
|
||||||
W: QWidgetH;
|
W: QWidgetH;
|
||||||
begin
|
begin
|
||||||
|
@ -206,9 +206,10 @@ function SetCaretPos(X, Y: Integer): Boolean; override;
|
|||||||
function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; override;
|
function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; override;
|
||||||
function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override;
|
function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override;
|
||||||
function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
function SetCursorPos(X, Y: Integer): Boolean; override;*)
|
||||||
function SetFocus(hWnd: HWND): HWND; override;
|
function SetFocus(hWnd: HWND): HWND; override;
|
||||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
function BackendSetFocus(hWnd: HWND): HWND;
|
||||||
|
(*function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||||
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; override;
|
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; override;
|
||||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;*)
|
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;*)
|
||||||
|
@ -51,7 +51,7 @@ type
|
|||||||
|
|
||||||
TCDWSCustomTabControl = class(TWSCustomTabControl)
|
TCDWSCustomTabControl = class(TWSCustomTabControl)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
@ -196,7 +196,7 @@ type
|
|||||||
|
|
||||||
TCDWSProgressBar = class(TWSProgressBar)
|
TCDWSProgressBar = class(TWSProgressBar)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||||
@ -234,7 +234,7 @@ type
|
|||||||
|
|
||||||
TCDWSTrackBar = class(TWSTrackBar)
|
TCDWSTrackBar = class(TWSTrackBar)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||||
@ -261,7 +261,7 @@ implementation
|
|||||||
|
|
||||||
{ TCDWSCustomTabControl }
|
{ TCDWSCustomTabControl }
|
||||||
|
|
||||||
class procedure TCDWSCustomTabControl.CreateCDControl(
|
class procedure TCDWSCustomTabControl.InjectCDControl(
|
||||||
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfPageControl.Create(AWinControl);
|
ACDControlField := TCDIntfPageControl.Create(AWinControl);
|
||||||
@ -287,8 +287,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSCustomTabControl.AddPage(
|
class procedure TCDWSCustomTabControl.AddPage(
|
||||||
@ -299,8 +302,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(ATabControl.Handle);
|
lCDWinControl := TCDWinControl(ATabControl.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(ATabControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(ATabControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
TCDPageControl(lCDWinControl.CDControl).InsertPage(AIndex, AChild.Caption);
|
TCDPageControl(lCDWinControl.CDControl).InsertPage(AIndex, AChild.Caption);
|
||||||
end;
|
end;
|
||||||
@ -392,7 +398,7 @@ end;*)
|
|||||||
|
|
||||||
{ TCDWSTrackBar }
|
{ TCDWSTrackBar }
|
||||||
|
|
||||||
class procedure TCDWSTrackBar.CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure TCDWSTrackBar.InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfTrackBar.Create(AWinControl);
|
ACDControlField := TCDIntfTrackBar.Create(AWinControl);
|
||||||
TCDIntfTrackBar(ACDControlField).LCLControl := TCustomTrackBar(AWinControl);
|
TCDIntfTrackBar(ACDControlField).LCLControl := TCustomTrackBar(AWinControl);
|
||||||
@ -416,8 +422,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSTrackBar.ApplyChanges(const ATrackBar: TCustomTrackBar);
|
class procedure TCDWSTrackBar.ApplyChanges(const ATrackBar: TCustomTrackBar);
|
||||||
@ -426,8 +435,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(ATrackBar, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(ATrackBar, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
TCDTrackBar(lCDWinControl.CDControl).Position := ATrackBar.Position;
|
TCDTrackBar(lCDWinControl.CDControl).Position := ATrackBar.Position;
|
||||||
|
|
||||||
@ -472,8 +484,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(ATrackBar, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(ATrackBar, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
Result := TCDTrackBar(lCDWinControl.CDControl).Position;
|
Result := TCDTrackBar(lCDWinControl.CDControl).Position;
|
||||||
end;
|
end;
|
||||||
@ -484,8 +499,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
lCDWinControl := TCDWinControl(ATrackBar.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(ATrackBar, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(ATrackBar, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
TCDTrackBar(lCDWinControl.CDControl).Position := NewPosition;
|
TCDTrackBar(lCDWinControl.CDControl).Position := NewPosition;
|
||||||
end;
|
end;
|
||||||
@ -519,7 +537,7 @@ end;
|
|||||||
|
|
||||||
{ TCDWSProgressBar }
|
{ TCDWSProgressBar }
|
||||||
|
|
||||||
class procedure TCDWSProgressBar.CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure TCDWSProgressBar.InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfProgressBar.Create(AWinControl);
|
ACDControlField := TCDIntfProgressBar.Create(AWinControl);
|
||||||
TCDIntfProgressBar(ACDControlField).LCLControl := TCustomProgressBar(AWinControl);
|
TCDIntfProgressBar(ACDControlField).LCLControl := TCustomProgressBar(AWinControl);
|
||||||
@ -543,8 +561,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSProgressBar.ApplyChanges(const AProgressBar: TCustomProgressBar);
|
class procedure TCDWSProgressBar.ApplyChanges(const AProgressBar: TCustomProgressBar);
|
||||||
@ -553,8 +574,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(AProgressBar.Handle);
|
lCDWinControl := TCDWinControl(AProgressBar.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AProgressBar, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AProgressBar, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
TCDProgressBar(lCDWinControl.CDControl).Position := AProgressBar.Position;
|
TCDProgressBar(lCDWinControl.CDControl).Position := AProgressBar.Position;
|
||||||
|
|
||||||
@ -600,8 +624,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(AProgressBar.Handle);
|
lCDWinControl := TCDWinControl(AProgressBar.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AProgressBar, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AProgressBar, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
TCDProgressBar(lCDWinControl.CDControl).Position := NewPosition;
|
TCDProgressBar(lCDWinControl.CDControl).Position := NewPosition;
|
||||||
end;
|
end;
|
||||||
|
@ -253,7 +253,7 @@ type
|
|||||||
|
|
||||||
TCDWSButton = class(TWSButton)
|
TCDWSButton = class(TWSButton)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||||
@ -268,7 +268,7 @@ type
|
|||||||
|
|
||||||
TCDWSCustomCheckBox = class(TWSCustomCheckBox)
|
TCDWSCustomCheckBox = class(TWSCustomCheckBox)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
@ -307,7 +307,7 @@ type
|
|||||||
// Make sure to override all methods from TCDWSCustomCheckBox which call CreateCDControl
|
// Make sure to override all methods from TCDWSCustomCheckBox which call CreateCDControl
|
||||||
TCDWSRadioButton = class(TWSRadioButton)
|
TCDWSRadioButton = class(TWSRadioButton)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
@ -325,7 +325,7 @@ type
|
|||||||
|
|
||||||
TCDWSCustomStaticText = class(TWSCustomStaticText)
|
TCDWSCustomStaticText = class(TWSCustomStaticText)
|
||||||
public
|
public
|
||||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
@ -1580,7 +1580,7 @@ end;*)
|
|||||||
|
|
||||||
{ TCDWSStaticText }
|
{ TCDWSStaticText }
|
||||||
|
|
||||||
class procedure TCDWSCustomStaticText.CreateCDControl(
|
class procedure TCDWSCustomStaticText.InjectCDControl(
|
||||||
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfStaticText.Create(AWinControl);
|
ACDControlField := TCDIntfStaticText.Create(AWinControl);
|
||||||
@ -1622,8 +1622,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*{------------------------------------------------------------------------------
|
(*{------------------------------------------------------------------------------
|
||||||
@ -1647,7 +1650,7 @@ end;*)
|
|||||||
|
|
||||||
{ TCDWSButton }
|
{ TCDWSButton }
|
||||||
|
|
||||||
class procedure TCDWSButton.CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure TCDWSButton.InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfButton.Create(AWinControl);
|
ACDControlField := TCDIntfButton.Create(AWinControl);
|
||||||
TCDIntfButton(ACDControlField).LCLControl := TButton(AWinControl);
|
TCDIntfButton(ACDControlField).LCLControl := TButton(AWinControl);
|
||||||
@ -1689,8 +1692,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCDWSButton.GetText(const AWinControl: TWinControl;
|
class function TCDWSButton.GetText(const AWinControl: TWinControl;
|
||||||
@ -1733,7 +1739,7 @@ end;*)
|
|||||||
|
|
||||||
{ TCDWSCustomCheckBox }
|
{ TCDWSCustomCheckBox }
|
||||||
|
|
||||||
class procedure TCDWSCustomCheckBox.CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
class procedure TCDWSCustomCheckBox.InjectCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfCheckBox.Create(AWinControl);
|
ACDControlField := TCDIntfCheckBox.Create(AWinControl);
|
||||||
TCDIntfCheckBox(ACDControlField).LCLControl := TCustomCheckBox(AWinControl);
|
TCDIntfCheckBox(ACDControlField).LCLControl := TCustomCheckBox(AWinControl);
|
||||||
@ -1774,8 +1780,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSCustomCheckBox.GetPreferredSize(
|
class procedure TCDWSCustomCheckBox.GetPreferredSize(
|
||||||
@ -1786,8 +1795,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
lCDWinControl.CDControl.LCLWSCalculatePreferredSize(
|
lCDWinControl.CDControl.LCLWSCalculatePreferredSize(
|
||||||
PreferredWidth, PreferredHeight, WithThemeSpace, AWinControl.AutoSize);
|
PreferredWidth, PreferredHeight, WithThemeSpace, AWinControl.AutoSize);
|
||||||
@ -1796,7 +1808,7 @@ end;
|
|||||||
|
|
||||||
{ TCDWSRadioButton }
|
{ TCDWSRadioButton }
|
||||||
|
|
||||||
class procedure TCDWSRadioButton.CreateCDControl(
|
class procedure TCDWSRadioButton.InjectCDControl(
|
||||||
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
ACDControlField := TCDIntfRadioButton.Create(AWinControl);
|
ACDControlField := TCDIntfRadioButton.Create(AWinControl);
|
||||||
@ -1840,8 +1852,11 @@ begin
|
|||||||
|
|
||||||
TCDWSWinControl.ShowHide(AWinControl);
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSRadioButton.GetPreferredSize(
|
class procedure TCDWSRadioButton.GetPreferredSize(
|
||||||
@ -1852,8 +1867,11 @@ var
|
|||||||
begin
|
begin
|
||||||
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||||
|
|
||||||
if lCDWinControl.CDControl = nil then
|
if not lCDWinControl.CDControlInjected then
|
||||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
begin
|
||||||
|
InjectCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
|
lCDWinControl.CDControlInjected := True;
|
||||||
|
end;
|
||||||
|
|
||||||
lCDWinControl.CDControl.LCLWSCalculatePreferredSize(
|
lCDWinControl.CDControl.LCLWSCalculatePreferredSize(
|
||||||
PreferredWidth, PreferredHeight, WithThemeSpace, AWinControl.AutoSize);
|
PreferredWidth, PreferredHeight, WithThemeSpace, AWinControl.AutoSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user