Programming Guide


Deletes an object

int sm_obj_delete(char *object);
int sm_obj_delete_id(int object_id);

object, object_id
The object (a widget or a component) to delete, specified either by its name or by an integer handle obtained from sm_prop_id for widgets, sm_obj_create for components, or from sm_obj_call.



sm_obj_delete and sm_obj_delete_id delete objects.

Deleting Widgets

The widget to delete can be on any screen on the window stack. If the widget is not on the current screen, supply its integer handle; or use the JPL object syntax to specify the source screen. For example, this JPL statement deletes cust_id from the custqry screen:

    call sm_obj_delete("@screen('custqry.scr')!cust_id")

Note: This function has no effect on the screen definition; to restore deleted widgets, close and reopen the screen.

Destroying Components

After invoking and working with the methods and properties of a component, you should destroy it by calling sm_obj_delete_id with the component's object ID. Otherwise, the component will continue to exist until the application terminates (or goes from test mode to edit mode).

Java objects returned by calls by sm_obj_create and to sm_obj_call should be deleted by sm_obj_delete_id to allow garbage collection of these objects by the JVM. (This does not happen automatically when switching from test to edit mode.)

If a COM component is running under MTS, its life cycle can be managed by MTS, depending on whether the component is marked as belonging to a transaction and whether the work in the transaction is complete.

    call sm_obj_delete_id(cmpt_id)

See Also

sm_obj_copy, sm_obj_create