Answered Pasting characters into a Password field

progdev1

Member
Hi folks,
I am wondering if anyone can help me here. Users have asked for the ability to paste a password from one application to a progress application. I see that by default you can not paste into a password field in Windows. I can paste into a password field in progress under Unix. I don't think this is a windows restriction as I can paste my password into other applications no problem.

I have looked at the trapping the CTRL-V and SHIFT-INS keys as a workaround and assign the field the value of the clipboard. This works, but then the problem I have is this doesn't allow the user to paste when the right click on a password field and selects paste from the menu.

Is there any field option I can change to allow a password be pasted by default?
Or alternatively is there a trigger I can use to trap the paste action on a field.
Any assistance would be appreciated.

Finally would anyone know if this is a progress bug on windows or if this is windows restricting what progress can do?
 
Last edited:

rzr

Member
You could try doing

Code:
ON CTRL-V OF cPasswordField IN FRAME DEFAULT-FRAME
DO:
    ASSIGN cPasswordField = CLIPBOARD:VALUE
           cPasswordField:SCREEN-VALUE = cPasswordField.
END.

ON RIGHT-MOUSE-CLICK OF cPasswordField IN FRAME DEFAULT-FRAME
DO:
    ASSIGN cPasswordField = CLIPBOARD:VALUE
           cPasswordField:SCREEN-VALUE = cPasswordField.
END.
 

progdev1

Member
rzr thanks a lot for you tip, it pointed me in the right direction. What worked better for me though was to create a frame within the window with a Paste button on it. Right clicking on the password field now causes frame f2 (see below) to appear instead of the system Menu box with Cut Copy and Paste on it. I enclosed the main code sections in an example below
Code:
DEFINE FRAME f-2
     butCopy AT ROW 2.67 COL 8 WIDGET-ID 12
     butCut AT ROW 1.48 COL 8 WIDGET-ID 10
     butPaste AT ROW 3.86 COL 8 WIDGET-ID 2
     RECT-1 AT ROW 1 COL 7 WIDGET-ID 8
    WITH 1 DOWN KEEP-TAB-ORDER OVERLAY
         SIDE-LABELS NO-UNDERLINE THREE-D
         AT COL 16 ROW 3.86
         SCROLLABLE SIZE 37 BY 5.24
         DEFAULT-BUTTON butPaste WIDGET-ID 200.

PROCEDURE enable_UI :
....
  ENABLE butPaste RECT-1
      WITH FRAME f-2 IN WINDOW C-Win.
....
END PROCEDURE.

ON RIGHT-MOUSE-CLICK OF fi-1 IN FRAME f-1 /* Fill 1 */
DO:
     ASSIGN FRAME f-2:VISIBLE = TRUE.
END.


ON "LEFT-MOUSE-CLICK"   OF C-Win ANYWHERE
DO:
    IF FRAME f-2:VISIBLE = TRUE THEN
        ASSIGN FRAME f-2:VISIBLE = FALSE.
    RETURN NO-APPLY.
END.
 
Top