Programming Guide



sm_obj_copy*

Copies a widget

#include <smuprapi.h>
int sm_obj_copy(char *target_widget, char *source_widget);
int sm_obj_copy_id(int target_widget_id, int source_widget_id);

target_widget, target_widget_id
The widget to receive the copied widget, specified either by name or by an integer handle obtained from sm_prop_id. It can specify a screen, a box, a tab card, a tab deck or a grid.

source_widget, source_widget_id
The widget to copy, specified either by its name or by an integer handle obtained from sm_prop_id. The widget to copy 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, supply this string to copy cust_id from the custqry screen:
@screen("custqry.scr")!cust_id.

Returns

Description

sm_obj_copy creates a copy of the specified widget and puts it in the target widget. The data and all properties of the source widget are copied to the new one, including its position on the screen. If the widget is copied onto the screen of the source widget, the new widget overlays the original. If a widget is copied to a box or to a tab card it will be moved if necessary.

If the source widget is named and the target screen already has a widget with the same name, Panther sets the new widget's name to an empty string to prevent duplicate names.

Copying Groups

sm_obj_copy can also copy a synchronized scrolling group or table view group; the function copies an empty group to the target screen—that is, the member widgets are not copied. You can subsequently copy one or more members of the group through additional calls to sm_obj_copy.

Selection groups cannot be copied directly; however if you copy a field that belongs to a selection group to another screen, Panther copies the field and its group to the target screen, provided that the target screen does not already contain a group of the same name; if it does, the copied field is added to the existing group.

See Also

sm_obj_delete_id