Jump to content
Developer Wiki and Function Reference Links ×

Adding to New Class Script


Recommended Posts

{///////////////////////////////////////////
CreateNewClass
(c) 2001 Nemetschek North America. Distribute freely.

Shows how to create a new class in a document.

///////////////////////////////////////////}

PROCEDURE CreateNewClass;
VAR
    newname    : STRING;
    ch            : HANDLE;
    
BEGIN
    { StrDialog() displays a dialog which prompts the user to enter }
    { a name for the new class being created.                       }

    newname:= StrDialog('Enter name of new class:','Untitled Class');
    
    { DidCancel detects if the user clicked the Cancel button. If the        }
    { the user did NOT click the Cancel button, then proceed with performing }
    { the operations in the code block.                                      }

    IF NOT DidCancel THEN BEGIN
    
        { check to see if the class name is in use }

        ch:= GetObject(newname);
        
        { if the class name is not in use, create the class; otherwise alert }
        { the user and exit the script                                       }

        IF (ch = NIL) THEN NameClass(newname) ELSE AlrtDialog('Class name already exists.');
    END;
END;
Run(CreateNewClass);
 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...