The X stands for a new position of a control in RAP. Normally in RAP one would use: begin Label1.Left := 108; end;
I would like to use: begin Label1.Left := CalcPixelsPerInch(108); // This value must be passed to the function. Might be any value. end;
unit FunctionsUnitRAP;
interface
uses Forms, raFunc, ppRTTI, FunctiesUnit4;
type TMyPixelsPerInch = class(TraSystemFunction) public class function category: String; override; end;
TMyPixelsPerInchFunction = class(TMyPixelsPerInch) public procedure ExecuteFunction(aParams: TraParamList); override; class function GetSignature: String; override; class function HasParams: boolean; override; end;
implementation
uses Hoofdscherm;
class function TMyPixelsPerInch.Category: string; begin result := 'Calculate PixelsPerInch'; end;
procedure TMyPixelsPerInchFunction.ExecuteFunction(aParams: TraParamList); begin // X is the value added in RAP. SetParamValue(0, ScaleFromSmallFontsDimension(X)); // <-- X should be passed by RAP end;
class function TMyPixelsPerInchFunction.GetSignature: String; begin Result := 'function CalcPixelsPerInch : Integer;'; end;
class function TMyPixelsPerInchFunction.HasParams: boolean; begin Result := True; // <- This might be needed to be set to True in order to pass variable X ???? end;
procedure TMyPixelsPerInchFunction.ExecuteFunction(aParams: TraParamList); var vInput : Integer; begin // X is the value added in RAP. GetParamValue(0, vInput); SetParamValue(1, ScaleFromSmallFontsDimension(vInput)); // <-- X should be passed by RAP end;
class function TMyPixelsPerInchFunction.HasParams: boolean; begin Result := True; end;
Try creating this routine in Delphi first, then create a passthru function for it. The basic rule of thumb is that if you can get it working in Delphi, it can work in RAP with passthru.
Comments
The X stands for a new position of a control in RAP.
Normally in RAP one would use:
begin
Label1.Left := 108;
end;
I would like to use:
begin
Label1.Left := CalcPixelsPerInch(108); // This value must be passed to
the function. Might be any value.
end;
unit FunctionsUnitRAP;
interface
uses Forms, raFunc, ppRTTI, FunctiesUnit4;
type
TMyPixelsPerInch = class(TraSystemFunction)
public
class function category: String; override;
end;
TMyPixelsPerInchFunction = class(TMyPixelsPerInch)
public
procedure ExecuteFunction(aParams: TraParamList); override;
class function GetSignature: String; override;
class function HasParams: boolean; override;
end;
implementation
uses Hoofdscherm;
class function TMyPixelsPerInch.Category: string;
begin
result := 'Calculate PixelsPerInch';
end;
procedure TMyPixelsPerInchFunction.ExecuteFunction(aParams: TraParamList);
begin
// X is the value added in RAP.
SetParamValue(0, ScaleFromSmallFontsDimension(X)); // <-- X should
be passed by RAP
end;
class function TMyPixelsPerInchFunction.GetSignature: String;
begin
Result := 'function CalcPixelsPerInch : Integer;';
end;
class function TMyPixelsPerInchFunction.HasParams: boolean;
begin
Result := True; // <- This might be needed to be set to True in order
to pass variable X ????
end;
initialization
raRegisterFunction('CalcPixelsPerInch',TMyPixelsPerInchFunction);
end.
procedure TMyPixelsPerInchFunction.ExecuteFunction(aParams: TraParamList);
var vInput : Integer;
begin
// X is the value added in RAP.
GetParamValue(0, vInput);
SetParamValue(1, ScaleFromSmallFontsDimension(vInput)); // <-- X should
be passed by RAP
end;
class function TMyPixelsPerInchFunction.HasParams: boolean;
begin
Result := True;
end;
Try creating this routine in Delphi first, then create a passthru
function for it. The basic rule of thumb is that if you can get it
working in Delphi, it can work in RAP with passthru.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com