DEFINE VARIABLE lStat AS LOGICAL NO-UNDO.
DEFINE MENU EditMenu MENU-ITEM EM_Cut LABEL "&Cut " MENU-ITEM EM_Copy LABEL "C&opy " MENU-ITEM EM_Paste LABEL "&Paste ". ON CHOOSE OF MENU-ITEM EM_Cut IN MENU EditMenu DO: IF FOCUS:TYPE = "EDITOR" THEN DO: IF FOCUS:SELECTION-START <> FOCUS:SELECTION-END THEN DO: CLIPBOARD:VALUE = FOCUS:SELECTION-TEXT. lStat = FOCUS:REPLACE-SELECTION-TEXT(""). END. ELSE DO: CLIPBOARD:VALUE = FOCUS:SCREEN-VALUE. FOCUS:SCREEN-VALUE = "". END. END. ELSE DO: /* For FILL-IN */ CLIPBOARD:VALUE = FOCUS:SCREEN-VALUE. FOCUS:SCREEN-VALUE = "". END. END. /* ON CHOOSE OF MENU-ITEM EM_Cut */ ON CHOOSE OF MENU-ITEM EM_Copy IN MENU EditMenu DO: IF FOCUS:TYPE = "EDITOR" THEN IF FOCUS:SELECTION-START <> FOCUS:SELECTION-END THEN CLIPBOARD:VALUE = FOCUS:SELECTION-TEXT. ELSE CLIPBOARD:VALUE = FOCUS:SCREEN-VALUE. ELSE IF FOCUS:TYPE = "RADIO-SET" THEN CLIPBOARD:VALUE = ENTRY(LOOKUP(FOCUS:SCREEN-VALUE, FOCUS:RADIO-BUTTONS) - 1, FOCUS:RADIO-BUTTONS). ELSE IF FOCUS:TYPE = "TOGGLE-BOX" THEN IF FOCUS:SCREEN-VALUE = "yes" THEN CLIPBOARD:VALUE = FOCUS:LABEL + " selected.". ELSE CLIPBOARD:VALUE = FOCUS:LABEL + " not selected.". ELSE /* For FILL-IN */ CLIPBOARD:VALUE = FOCUS:SCREEN-VALUE. END. /* ON CHOOSE OF MENU-ITEM EM_Copy */ ON CHOOSE OF MENU-ITEM EM_Paste IN MENU EditMenu DO: IF FOCUS:TYPE = "EDITOR" THEN DO: IF FOCUS:SELECTION-START <> FOCUS:SELECTION-END THEN lStat = FOCUS:REPLACE-SELECTION-TEXT(CLIPBOARD:VALUE). ELSE lStat = FOCUS:INSERT-STRING(CLIPBOARD:VALUE). END. ELSE /* For FILL-IN */ FOCUS:SCREEN-VALUE = CLIPBOARD:VALUE. END. /* ON CHOOSE OF MENU-ITEM EM_Paste */ |