![]() | Programming Guide | ![]() |
Duplicates the data on the screen so it can be edited
int sm_tm_command ("COPY");
COPYcopies 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 aNEWcommand. 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
SAVEto insert the data into the database. If you selectSAVEwithout changing any data, the transaction manager generates anINSERTstatement 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
COPYcommand can choose to set the class property tocopy_button. By default,copy_buttonis active in all transaction modes.
COPYis available after you enter new data usingNEWandSAVE. It is also available afterSELECTorVIEWwhich display data on the screen. SelectSAVEafter you finish your edits.
The following requests can be generated by the
COPYcommand 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_DISCARDrequest is made for theCOPYcommand, the discard flag used inTM_POST_SAVE1is not set.