Re: Objects in VM files

GWRepNate@aol.com
Sun, 24 Nov 1996 12:08:43 -0500

If you're using VMPreserveBlocksHandle() then you don't have to reconstruct
the optr for the duplicate primary object. In fact, doing so may give you the
wrong handle (not sure about that). Using VMPreserveBlocksHandle() you can
construct the optr to the duplicate once and keep using that same optr until
you detach for free the block. You can save the optr as part of the instance
data of the document object, for convenience.

Three other things: 1) You don't need to set the object disabled to add it to
another object. 2) You can send messages to "application" instead of "App".
It's a reserved word just like "process" or "self". In your case "App" is a
shorter name and simpler. In my apps I always have longer names for the
objects and so "application" is a nice shortcut. 3) To reduce code size you
can construct the optr once and refer to the variable name. However, you're
going to save the optr in MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE anyway
and won't need to construct it again in
MSG_GEN_DOCUMENT_ATTACH_UI_TO_DOCUMENT. Just pointing out the opportunity for
optimization.

Nathan