blikblum/luipack

UniqueInstance needs new event

Alexey-T opened this issue · 8 comments

See if 7b149b4 fits your need

it is almost ok.
now I think that CudaText needs another change in UniqInst.
my app calls Loaded() method

a) we need to move Loaded from 'protected' to 'public' (app needs TUniqIntanceHack type if Loaded is 'protected')
b) we need Loaded with parameter - "const array of string".

so Cud will prepare this 'array of string' w/o events. and give it to Loaded().

Loaded is called by lcl without parameters so It cannot be changed.

Please create a simple example so we evaluate the use case

pseudo code -

var p: array of string;

SetLength(p, ParamCount);
for i:= 1 to ParamCount do
  p[i-1]:= mydir+'/'+ParamStr(i);

UniqInst.NewLoadedNeeded(p);

You can already mutate the command line parameter using OnPrepareParam that is called internally by Loaded, so no need to a new Loaded method

TForm.PrepareParam(Sender : TObject; var Param: String);
begin
  Param := mydir+'/'+ Param;
end;

Ok thanks.

If you want to remove an Param, set Param to ''