Hey Tim,
Thanks for clarifying the point about the recommendation. Also looking for
other references I saw this issue has been coming up from time to time with
no real resolution and apparently only on Macs.

You know the tech tip you referenced is really pretty cool. Since we're
talking about it I changed it from a field script into a project method
that could be called from an input variable. Two benefits to this approach:

1) it works on any text field
2) I didn't have to re-write any password code


The old forms had the 'password' var right on the form, of course. To
implement this all I had to do was change the 'password' input var to a
dynamic variable, enable the two form events and add the script as:

Password_gather (self; ->ExistingPasswordVar)


Then I could just copy that form object and paste it into all the forms
that referenced the password var.

 // Method: Password_gather (pointer; pointer)
  // $1 is text var on screen
  // $2 is text var of actual password
  // Purpose: $1 is text var on password form
  // $2 is the actual password.
  // Gets edited text from form, appends to $2 (actual pw)
  // and replaces form var with #. This prevents capturing the
  // password from the input form.

C_POINTER($1;$2)

C_TEXT($tempString;$char)
C_LONGINT(vlastPosition;$i)

$char:="*"  //  this is the char displayed on screen

Case of
: (Form event=On Load)
$1->:=""  // The user will only see the content of this variable.
$2->:=""  // The actual text value the user typed in.
vlastPosition:=0

: (Form event=On After Keystroke)
$tempString:=Get edited text

If (Length($tempString)>vlastPosition)
vlastPosition:=Length($tempString)
$1->:=""

For ($i;1;vlastPosition)
$1->:=$1->+$char
End for

If (vlastPosition>1)
$tempString:=Delete string($tempString;1;vlastPosition-1)
End if
$2->:=$2->+$tempString

Else
$2->:=Delete string($2->;vlastPosition;vlastPosition)
vlastPosition:=vlastPosition-1
End if

End case

  //[End Password_gather ]


On Fri, Oct 14, 2016 at 4:35 PM, Timothy Penner <tpen...@4d.com> wrote:

> Hi Kirk,
>
> I wouldn’t say it is discouraged - it is still documented in example 3 of
> OBJECT SET FONT:
> http://livedoc.4d.com/4Dv15-R5/help/Command/en/page164.html#197877
> Quote: "Note: You can use the %password option with field, variable and
> combo box type objects."
>
> I had to search my sent items for 14045 to see what I said; it looks like
> I mentioned this tip in reference to the %password font not working with
> ALP...
> http://kb.4d.com/resources/inug?msgid=GmailId1467388e3e922028
>
> -Tim PENNER
>
>
>
> -----Original Message-----
> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Kirk
> Brooks
> Sent: Friday, October 14, 2016 12:25 PM
> To: 4D iNug Technical
> Subject: Re: Any issues with %password font on MacOS and 13.6?
>
> Hi Chuck,
> It turns out using the password font is discouraged in favor of capturing
> the characters from the screen, building the password in a hidden variable,
> and displaying a field with just asterisks or something else.
>
> Tim Penner posted a reply a while ago about this with a link here:
> http://kb.4d.com/assetid=14045
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************
>



-- 
Kirk Brooks
San Francisco, CA
=======================
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to