On Wednesday 12 June 2013 07:48:06 Ivanko B wrote:
> Martin, could You desribe TActivator briefly - typical scenarios
> to_use/not_to_use, caveats,.. ?
> It's really messy.
>
Really? It simply acitivates/deactivates the clients in the given order.

"
procedure tactivator.activateclients;
var
 int1: integer;
 bo1,bo2: boolean;
 act1: activatorabortactionty;
begin
 try
  if avo_waitcursor in foptions then begin
   application.beginwait;
  end;
  factive:= true;
  factivated:= true;
  if canevent(tmethod(fonbeforeactivate)) then begin
   fonbeforeactivate(self);
  end;
  if factive then begin
   updateorder;
   bo2:= canevent(tmethod(fonactivateerror));
   for int1:= 0 to high(fclients) do begin
    try
     iobjectlink(fclients[int1]).objevent(ievent(self),oe_activate);
    except
     on e: exception do begin
      bo1:= false;
      if bo2 then begin
       fonactivateerror(self,iobjectlink(fclients[int1]).getinstance,e,bo1);
      end;
      if not bo1 then begin
       if (avo_handleexceptions in foptions) and 
                      not (csdesigning in componentstate) then begin
        if not (avo_quietexceptions in foptions) then begin
         application.showexception(e);
        end;
       end
       else begin
 //       factive:= false;
        raise;
       end;
      end;
      if avo_abortonexception in foptions then begin
       act1:= fabortaction;
       if canevent(tmethod(fonabort)) then begin
        fonabort(self,act1);
       end;
       factivated:= false; //no activation in clients.loaded
       case act1 of
        aaa_retry,aaa_deactivate: begin
         deactivateclients;
         if act1 = aaa_retry then begin
          activateclients;
         end;
         exit;
        end;
        aaa_abortexception: begin
         abort;
        end;
       end;
       break;
      end;
     end;
    end;
   end;
   if canevent(tmethod(fonafteractivate)) then begin
    fonafteractivate(self);
   end;
  end;
 finally
  if avo_waitcursor in foptions then begin
   application.endwait;
  end;
 end;
end;

procedure tactivator.deactivateclients;
var
 int1: integer;
begin
 factive:= false;
 if canevent(tmethod(fonbeforedeactivate)) then begin
  fonbeforedeactivate(self);
 end;
 if not active then begin
  updateorder;
  if avo_deactivatebottomup in foptions then begin
   for int1:= 0 to high(fclients) do begin
    iobjectlink(fclients[int1]).objevent(ievent(self),oe_deactivate);
   end;
  end
  else begin
   for int1:= high(fclients) downto 0 do begin
    iobjectlink(fclients[int1]).objevent(ievent(self),oe_deactivate);
   end;
  end;
  if canevent(tmethod(fonafterdeactivate)) then begin
   fonafterdeactivate(self);
  end;
 end;
end;

procedure tactivator.setactive(const avalue: boolean);
begin
 if avalue <> factive then begin
  if componentstate * [csloading,csdesigning] = [csloading,csdesigning] then 
begin
   factive:= avalue;
  end
  else begin
   if not (csloading in componentstate) then begin
    if avalue then begin
     activateclients;
    end
    else begin
     deactivateclients;
    end;
   end;
  end;
 end;
end;
"

Messy probably is inter-module component-property resolving.

Martin

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to