ENTRY PASSWORD IN DIALOG

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nodochau
Pro Scripter
Posts: 135
Joined: Wed Jan 16, 2019 12:59 pm

ENTRY PASSWORD IN DIALOG

Post by nodochau » Thu Jun 27, 2019 1:12 pm

Hello All,
I am creating a Dialog to ask users entry their password to go to the next step. When users type their PW in the box how can we change it to asterisk symbol only?
For ex: Instead of showing 12345 PW on screen, I want this ***** is shown when user types the PW.
Thanks

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: ENTRY PASSWORD IN DIALOG

Post by JRL » Thu Jun 27, 2019 3:00 pm

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 317
  Top = 198
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Enter your password'
  ClientHeight = 113
  ClientWidth = 340
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 272
    Top = 24
    Width = 32
    Height = 13
    Caption = 'VIEW'
  end
  object Edit1: TEdit
    Left = 39
    Top = 15
    Width = 218
    Height = 21
    PasswordChar = '*'
    TabOrder = 0
    Text = 'PasswordChar is *'
  end
  object MSButton1: tMSButton
    Left = 133
    Top = 78
    Width = 75
    Height = 25
    Caption = 'Ok'
    TabOrder = 9
    Default = True
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSButton1,OnClick,srtProcess
AddDialogHandler>Dialog1,Label1,OnMouseDown,srtDisplayChars
AddDialogHandler>Dialog1,Label1,OnMouseUp,srtHideChars
AddDialogHandler>Dialog1,,OnClose,Quit

Show>Dialog1,

SRT>srtProcess
  GetDialogProperty>Dialog1,Edit1,Text,vPWStr
  MDL>vPWStr
  Exit>0
END>srtProcess

SRT>srtDisplayChars
    SetDialogProperty>Dialog1,Edit1,PasswordChar,nullchar
END>srtDisplayChars

SRT>srtHideChars
    SetDialogProperty>Dialog1,Edit1,PasswordChar,*
END>srtHideChars

SRT>Quit
  Exit>0
END>Quit

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts