Programming Guide |
Duplicates the data on the screen so it can be edited
int sm_tm_command ("COPY");
COPY
copies the data on the screen for use in the next insertion.After you select
COPY
, the following steps occur:
- If you have made changes in the table views on which this command operates in a previous
NEW
,COPY
,COPY_FOR_UPDATE
, orSELECT
, you are prompted to discard your changes. If you chooseOK
, changes are discarded; however, the data remains visible and is treated as though you had just typed it in after aNEW
command. If you choose Cancel, you return to the screen so you can save your changes.- The data currently displayed on the screen is copied.
- The transaction mode is set to new. By default, this mode clears all the protection bits in updatable table views to reflect that data entry is available in those widgets.
- Edit the data as much as you wish. Select
SAVE
to insert the data into the database. If you selectSAVE
without changing any data, the transaction manager generates anINSERT
statement for the duplicate data. Depending on the engine, this could result in a duplicate entry or in an engine error.Push buttons and menu selections for the
COPY
command can choose to set the class property tocopy_button
. By default,copy_button
is active in all transaction modes.
COPY
is available after you enter new data usingNEW
andSAVE
. It is also available afterSELECT
orVIEW
which display data on the screen. SelectSAVE
after you finish your edits.
The following requests can be generated by the
COPY
command to ascertain whether the changes from the previous command have been saved and, if desired, to discard those changes:
TM_PRE_CLOSE
(described underCLOSE
)
TM_CLOSE
(described underCLOSE
)
Since no
TM_DISCARD
request is made for theCOPY
command, the discard flag used inTM_POST_SAVE1
is not set.