shineworld 73 Posted September 15, 2021 Hi all, I've many TFrame objects which can implement one or more interfaces, depends. There is a Delphi way to check if a frame implements an interface? E.g: procedure UpdateTheme(Obj: TFrame); begin if "Obj implements ITheme" then (Obj as ITheme).UpdateTheme; end; Share this post Link to post
Dalija Prasnikar 1396 Posted September 15, 2021 Use Supports function var LTheme: ITheme; begin if Supports(Obj, ITheme, LTheme) then LTheme.UpdateTheme; end; 1 Share this post Link to post
Vincent Parrett 750 Posted September 15, 2021 procedure UpdateTheme(Obj: TFrame); var objAsIThen : ITheme; begin If Supports(Obj, ITheme, objAsIThen) then objAsITheme.UpdateTheme; end; 1 Share this post Link to post