📄 dxjsaddstdctrls.pas
字号:
////////////////////////////////////////////////////////////////////////////
// Component: TDXJSAddStrCtrls
// Author: G.E. Ozz Nixon Jr. (staff@bpdx.com)
// ========================================================================
// Source Owner: DX, Inc. 2002, 2004
// Copyright: All code is the property of DX, Inc. Licensed for
// resell by Brain Patchwork DX (tm) and part of the
// DX (r) product lines, which are (c) 1999-2002
// DX, Inc. Source may not be distributed without
// written permission from both Brain Patchwork DX,
// and DX, Inc.
// License: (Reminder), None of this code can be added to other
// developer products without permission. This includes
// but not limited to DCU's, DCP's, DLL's, OCX's, or
// any other form of merging our technologies. All of
// your products released to a public consumer be it
// shareware, freeware, commercial, etc. must contain a
// license notification somewhere visible in the
// application.
// Code Version: (3rd Generation)
// ========================================================================
// Description: Implement TForm support to instance of javascript that is
// specified in the javascript property. Introduces the parent TForm, and
// all associated constants for TForm, plus a couple of the public methods.
// ========================================================================
////////////////////////////////////////////////////////////////////////////
unit DXJSAddStdCtrls;
interface
uses
DXJavaScript,
Forms,
Classes;
type
TDXJSAddStdCtrls = class(TComponent)
private
fJavaScript:TDXJavaScript;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent); override;
destructor Destroy; override;
Procedure RegisterWithJavaScript;
published
{ Published declarations }
Property JavaScript:TDXJavaScript read fJavaScript write fJavaScript;
end;
//procedure Register;
implementation
Uses
Controls,
Graphics,
StdCtrls.
SysUtils;
constructor TDXJSAddStdCtrls.Create(AOwner:TComponent);
Begin
inherited Create(AOwner);
End;
destructor TDXJSAddStdCtrls.Destroy;
Begin
inherited Destroy;
End;
///////////////////////////////////////////////////////////////////////////////
// DXJavaScript Call back hooks!
// ============================================================================
// methods
///////////////////////////////////////////////////////////////////////////////
function __BringToFront(Instance: TObject; const Parameters: array of Variant): Variant;
begin
TForm(Instance).BringToFront;
end;
function __TextOut(Instance: TObject; const Parameters: array of Variant): Variant;
begin
TCanvas(Instance).TextOut(Parameters[0], Parameters[1], Parameters[2]);
end;
function __TForm_Hide(Instance: TObject; const Parameters: array of Variant): Variant;
begin
TForm(Instance).Hide;
end;
///////////////////////////////////////////////////////////////////////////////
// non-published property
///////////////////////////////////////////////////////////////////////////////
function __TForm_GetCanvas(Instance: TObject; const Parameters: array of Variant): Variant;
begin
result := TDXJavaScript.DelphiObjectToVariant(TForm(Instance).Canvas);
end;
function __TForm_GetFont(Instance: TObject; const Parameters: array of Variant): Variant;
begin
result := TDXJavaScript.DelphiObjectToVariant(TForm(Instance).Font);
end;
///////////////////////////////////////////////////////////////////////////////
// assign these hooks to DXJavaScript
///////////////////////////////////////////////////////////////////////////////
Procedure TDXJSAddTForm.RegisterWithJavaScript;
Begin
if Assigned(fJavaScript) then Begin
// Constants (for some of the Properties)
With fJavaScript do Begin
// .TTextLayout
AddConstant('tlTop',0);
AddConstant('tlCenter',1);
AddConstant('tlBottom',2);
// .TEditCharCase
AddConstant('ecNormal',0);
AddConstant('ecUpperCase',1);
AddConstant('ecLowerCase',2);
// .TScrollStyle
AddConstant('ssNone',0);
AddConstant('ssHorizontal',1);
AddConstant('ssVertical',2);
AddConstant('ssBoth',3);
// .TComboBoxStyle
AddConstant('csDropDown',0);
AddConstant('csSimple',1);
AddConstant('csDropDownList',2);
AddConstant('csOwnerDrawFixed',3);
AddConstant('csOwnerDrawVariable',4);
// .TCheckBoxState
AddConstant('cbUnchecked',0);
AddConstant('cbChecked',1);
AddConstant('cbGrayed',2);
// .TScrollCode
AddConstant('scLineUp',0);
AddConstant('scLineDown',1);
AddConstant('scPageUp',2);
AddConstant('scPageDown',3);
AddConstant('scPosition',4);
AddConstant('scTrack',5);
AddConstant('scTop',6);
AddConstant('scBottom',7);
AddConstant('scEndScroll',8);
// .TStaticBorderStyle
AddConstant('sbsNone',0);
AddConstant('sbsSingle',1);
AddConstant('sbsSunken',2);
// Add methods
AddMethod(TCustomLabel, 'Caption', @__TCustomLabel_Caption);
// AddMethod(TForm, 'Hide', @__TForm_Hide);
// Add non-published property
AddProperty(TForm, 'Canvas', @__TForm_GetCanvas, nil);
AddObject(fParent.Name,fParent);
End;
End;
End;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -