Innerfuse Pascal Script
Back to Libraries
ifsdfrm
function GetCV_Int2: Pointer;
Returns the CV_Int2 pointer. Internally needed for the ctrlstd library.
function GetControl(SE: TIFPasScript; C: PCreatedClass): TControl;
Returns a pointer to the real TControl.
function AddTObjectFreeProc(SE: TIFPasScript; P: TObject): TObject;
returns P again. Use this to call the AddResource and automaticly free a properly override destroy method of TObject.
function Proc2Method(Proc, SelfPtr: Pointer): TMethod;
A delphi method is a pair of two pointers, use this function to create a method and assign it like: Control.OnClick := TNotifyEvent(Proc2Method(@Proc, ....)); SelfPtr is the first parameter that will be send to the method (the Self pointer in delphi).
The following are standard methods to use. use it like proc2Method(@MyOnKeyPress, ScriptEngine).
procedure MyOnKeyPress(ScriptEngine: TIfPasScript; Sender: TControl; var Key: Char);
procedure MyOnClick(ScriptEngine: TIfPasScript; Sender: TControl);
procedure MyOnChange(ScriptEngine: TIfPasScript; Sender: TControl);
procedure MyOnDblClick(ScriptEngine: TIfPasScript; Sender: TControl);
procedure MyOnCloseQuery(ScriptEngine: TIfPasScript; Sender: TControl; var CanClose: Boolean);
procedure RegisterFormsLibrary(p: TIfPasScript);
This will register the forms library.
`const
fsBold = 1;
fsItalic = 2;
fsUnderline = 4;
fsStrikeOut = 8;
type
TNotifyEvent = procedure(Sender: TObject);
TCloseQueryEvent = procedure(Sender: TObject; Var CanClose: Boolean);
TKeyPressEvent = procedure(Sender: TObject; var Key: Char);
TControl = class(TObject)
private
FParent: TControl;
protected
FOnKeyPress: TKeyPressEvent;
FOnCloseQuery: TCloseQueryEvent;
FOnChange,
FOnClick,
FOnDblClick: TNotifyEvent;
FControl: ResourcePointer;
procedure SetEnabled(B: Boolean); virtual;
function GetEnabled: Boolean;
procedure SetLeft(I: Integer); virtual;
procedure SetTop(I: Integer); virtual;
procedure SetWidth(I: Integer); virtual;
procedure SetHeight(I: Integer); virtual;
function GetLeft: Integer; virtual;
function GetTop: Integer; virtual;
function GetWidth: Integer; virtual;
function GetHeight: Integer; virtual;
function GetVisible: Boolean; virtual;
procedure SetVisible(b: Boolean); virtual;
function GetControl: ResourcePointer;
function GetFontName: string;
function GetFontSize: Integer;
function GetFontColor: Integer;
function GetFontStyle: Byte;
procedure SetFontName(s: string);
procedure SetFontSize(i: Integer);
procedure SetFontColor(i: Integer);
procedure SetFontStyle(b: Byte);v function GetColor: Longint;
property SetColor(I: Longint);
public
Constructor Create(AParent: TControl);
property Parent: TControl read FParent;
procedure SetBounds(Left, Top, Width, Height: Integer);
property Left: Integer read GetLeft write SetLeft;
property Top: Integer read GetTop write SetTop;
property Width: Integer read GetWidth write SetWidth;
property Height: Integer read GetHeight write SetHeight;
property Visible: Boolean read GetVisible write SetVisible;
property FontName: string read GetFontName write SetFontName;
property FontSize: Integer read GetFontSize write SetFontSize;
property FontColor: Integer read GetFontColor write GetFontColor;
property FontStyle: Byte read GetFontStyle write GetFontStyle;
property Enabled: Boolean read GetEnabled write SetEnabled;
property OnKeyPress: TKeyPressEvent read/write;
property OnChange: TNotifyEvent read/write;
property OnClick: TNotifyEvent read/write;
property OnDblClick: TNotifyEvent read/write;
property OnCloseQuery: TCloseQueryEvent read/write;
property Color: Longint read GetColor write GetColor;
end;
const
bsNone = 0;
bsSingle = 1;
bsDialog = 2;
bsSizeable = 3;
biSystemMenu = 1;
biMinimize = 2;
biMaximize = 4;
type
TForm = class(TControl)
private
public
constructor Create;
destructor Destroy; override;
procedure Close;
procedure Center;
property Caption: string read/write;
property Color: Integer read/write;
property BorderStyle: Byte read/write;
property BorderIcons: Byte read/write;
procedure SetActiveControl(c: TControl);
end;
procedure ProcessMessages;
`
Copyright (c) 2001 by Carlo Kok
last update: 24-11-01