OOP_(re)

Sat, 31 May 1997 14:38:28 -0400 (EDT)


On Fri, 30 May 1997, The African Chief wrote:

> for i := 1 to GetObjectCount do begin
>     p := InstanceFromSelfID ( i );
>     If Assigned ( p ) then begin
>        If p^.Name = 'CHIEFDIALOG' then { blah blah }
>        else If p^.Name = 'CHIEFCONTROL' then {blah blah}
>        else {blah blah};
>    end;
> end;

(assuming a little change that the aList object moves to the interface
section)

var
	P: PListUnit;
begin
	P:=aList.Head;
	while assigned(P) do begin
		case typeof(P^.TheObject^) of
			typeof(CHIEFDIALOG): { blah blah }
			typeof(CHIEFCONTROL): { blah blah }
		otherwise { blah blah }
	end;
end;

Plus or minus a few possible bugs, this would do exactly what you did,
without either the SelfID or the Name.

Pierre Phaneuf

"The use of COBOL cripples the mind; its teaching should, therefore, be
regarded as a criminal offense." - Edsger W. Dijkstra.


Pierre Phaneuf (pp@dilu.ml.org)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es