Sam Jones Posted August 15, 2021 Share Posted August 15, 2021 Is there a way to find out if a class exists? If a class of a certain name does not exist, I want to create it and set its attributes. If it already exists, I don't want to change any attributes. I can't find a way to check if a class exists. Lost in the Funciton Reference woods. Sam Quote Link to comment
Julian Carr Posted August 16, 2021 Share Posted August 16, 2021 I think you'll need something like this (untested): Function DoesClassExist(sMyClassName : STRING) : BOOLEAN; VAR i1 : INTEGER; BEGIN DoesClassExist := False; FOR i1 := 1 TO ClassNum DO BEGIN IF ClassList(i1) = sMyClassName THEN BEGIN DoesClassExist := True; i1 := ClassNum; END; END; END; Quote Link to comment
JBenghiat Posted August 16, 2021 Share Posted August 16, 2021 You can actually get a handle to a class, so: GetObject(className) if handle is nil return false else return type of object is 94 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.