In TMS Scripter I added a new component which I can now use in Scripter IDE.
AIDEEngine.RegisterComponent('Additional', TAdvSmoothSpinner, 'DBCtrls,ComCtrls,StdCtrls,ExtCtrls,Buttons');
It seemed to work well but as soon as I program the Event "OnSelectedValueChanged" I get a scripter error.
procedure ZahlenradSelectedValueChanged(Sender: TObject; Column, SelectedCustomIndex: Integer; SelectedValue: Double; RangeType: TAdvSmoothSpinnerRangeType);
begin
;
end;
What can I do?
wlandgraf
(Wagner Landgraf)
November 17, 2022, 1:17pm
2
You have to register the event type in scripter, so the event can be supported. This is indeed not trivial and must be done for each different event type you want to use.
Here are a few previous Support Center topics with explanation and sample code for such process:
Yes I have found the problem.
I have used :
Scripter.DefineClassByRTTI(TECCanvas);
But DefineClassByRTTI seem to fail with record argument like Trect ?
So I have fixed it with :
With Scripter.DefineClass(TECCanvas) do
begin
DefineMethod('TextRect',4,tkNone,nil,__TECCanvasTextRect,false,0,'rect: TRect; X: integer; Y: integer; Text: string');
end;
I never know if I must use RTTI or not (with Scripter Studio Import tool) because both have it advantage and inconvenient...
Hello, use this: DefineEventAdapter(TypeInfo(TDrawColumnCellEvent), TMyDBGridsDispatcher, @TMyDBGridsDispatcher.__TDBGridDrawColumnCell);
type
TMyDBGridsDispatcher = class(TatEventDispatcher)
private
procedure __TDBGridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
end;
uses ap_Types
procedure TMyDBGridsDispatcher.__TDBGridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; St…
For some reason a customer who upgraded to our latest version is having an issue with an OnDrawCell event. They get the error: "TRzStringGrid: OnDrawCell Event adapter not defined." I see in the manual this:"the OnEvent handlers are not automatically defined by scripter. You must implement aTatEventDispatcher descendant class and use DefineEventAdapter method." But I couldn't find any information on how the DefineEventAdapter methods work in the docs. Here is how the procedure is defined:procedu…
I have managed to make it work.
Here my solution (if anyone else has the same problem).
I can use TAdvSmoothSpinner now within the Scripting engine
...
AIDEEngine.RegisterComponent('Additional', TAdvSmoothSpinner, 'DBCtrls,ComCtrls,StdCtrls,ExtCtrls,Buttons');
DefineEventAdapter(TypeInfo(TAdvSmoothSpinnerSelectedValueChangedEvent), TMySelectedValueChangedEventDispatcher,
@TMySelectedValueChangedEventDispatcher.__TSelectedValueChanged);
...
type
TMySelectedValueChangedEventDispatcher = class(TatEventDispatcher)
private
procedure __TSelectedValueChanged(Sender: TObject; Column, SelectedCustomIndex: Integer; SelectedValue: Double; RangeType: TAdvSmoothSpinnerRangeType);
end;
procedure TMySelectedValueChangedEventDispatcher.__TSelectedValueChanged(
Sender: TObject; Column, SelectedCustomIndex: Integer; SelectedValue: Double;
RangeType: TAdvSmoothSpinnerRangeType);
var
MyRangeTypeSet: TAdvSmoothSpinnerRangeType;
MyRangeType: Variant;
begin
MyRangeTypeSet := RangeType;
MyRangeType := IntFromSet(MyRangeTypeSet, SizeOf(TAdvSmoothSpinnerRangeType));
if Assigned(Scripter) and (RoutineName > '') then begin
Scripter.ExecuteSubroutine(RoutineName, [Sender, Column, SelectedCustomIndex, SelectedValue, MyRangeType]);
end;
end;
1 Like
system
(system)
Closed
November 18, 2022, 12:22pm
4
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.