dss-extensions/dss_capi

Lines/API: active element inconsistency

PMeira opened this issue · 1 comments

The interface for the other individual components use their respective lists to control the active element of that type.

The Lines interface is inconsistent with that, using the active circuit element instead:

//TODO: use the active line instead?
CktElem := ActiveCircuit.ActiveCktElement;
if CktElem = NIL then
begin
if DSS_CAPI_EXT_ERRORS then
begin
DoSimpleMsg('No active Line object found! Activate one and retry.', 8989);
end;
Exit;
end;

For consistency, it would be ideal to change this behavior to match the other components. For example, reactors:

obj := ActiveCircuit.Reactors.Active;
if obj = NIL then
begin
if DSS_CAPI_EXT_ERRORS then
begin
DoSimpleMsg('No active Reactor object found! Activate one and retry.', 8989);
end;
Exit;
end;

With the refactoring done in ac460b0, this only affects the _activeObj function. It would be reasonable to use the dedicated active line element by default, and use the proposed compatibility flag (#61) to toggle the original behavior.

I'll change the behavior and add the compatibility flag to restore the inconsistent version for the next version.