I have made a quick test now and I could replace the functionality of TSpinButton with TUpDown but I also need to put a case statement in the OnClick event for the component where the actions are selected:
procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
case Button of
btNext:
begin
if HVIndex = 255 then exit;
Inc(HVIndex);
Edit1.Text := FormatFloat('0', HVIndex * 1.6);
end;
btPrev:
begin
if HVIndex = 0 then exit;
Dec(HVIndex);
Edit1.Text := FormatFloat('0', HVIndex * 1.6);
end;
end;
This does what it is supposed to do but involves a lot of changes that cannot easily be done as global replaces...
But it might not be avoidable...
In order for it to work seamlessly I would have to create a child of TUpDown where the two events are added (don't know how to do this) and also somehow integrate this into Lazarus so it becomes part of the component palette. This way future ports of other similar applications would be simpler.
OTOH, then the special component package would have to be installed whenever I set up a new FPC/Lazarus environment (happens frequently).
I guess no matter what I do I will have a problem...
Edit:In the code example above I pulled in the code from the original 2 events, but I might also just call these respectively:
procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
case Button of
btNext: spbMaxVoltageUpClick(Self);
btPrev: spbMaxVoltageDownClick(Self);
end;
end;