1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

New PasswordField property for TextBox control.

Uses CHR$(7) for inbuilt fonts or UTF-8 e2978f for ttf fonts.
This commit is contained in:
FellippeHeitor 2016-12-16 20:44:29 -02:00
parent d9fc27385c
commit 3a65e1bf11
2 changed files with 17 additions and 2 deletions

View file

@ -85,6 +85,7 @@ TYPE __UI_ControlTYPE
'ThumbLeft AS INTEGER
'HScrollbarRatio AS SINGLE
Cursor AS LONG
PasswordField AS _BYTE
PrevCursor AS LONG
FieldArea AS LONG
PreviousFieldArea AS LONG

View file

@ -677,9 +677,23 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
IF NOT This.Multiline THEN
'Single line textbox
DIM ThisTempText$
ThisTempText$ = __UI_TrimAt0$(Text(This.ID))
IF LEN(ThisTempText$) > 0 AND This.PasswordField = True THEN
IF This.Font <> 8 AND This.Font <> 16 THEN
ThisTempText$ = ""
FOR i = 1 TO LEN(Text(This.ID))
ThisTempText$ = ThisTempText$ + CHR$(226) + CHR$(151) + CHR$(143) 'UTF-8 e2978f
NEXT
ELSE
ThisTempText$ = STRING$(LEN(ThisTempText$), 7)
END IF
END IF
IF ((__UI_Focus = This.ID) OR (This.ID = __UI_PreviousFocus AND __UI_ParentMenu = This.ContextMenuID)) AND NOT This.Disabled THEN
IF LEN(Text(This.ID)) THEN
__UI_PrintString CaptionIndent - This.InputViewStart, ((This.Height \ 2) - uspacing& \ 2), __UI_TrimAt0$(Text(This.ID))
__UI_PrintString CaptionIndent - This.InputViewStart, ((This.Height \ 2) - uspacing& \ 2), ThisTempText$
ELSE
__UI_PrintString CaptionIndent, ((This.Height \ 2) - uspacing& \ 2), TempCaption$
END IF
@ -702,7 +716,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
END IF
ELSE
IF LEN(Text(This.ID)) THEN
__UI_PrintString CaptionIndent, ((This.Height \ 2) - uspacing& \ 2), __UI_TrimAt0$(Text(This.ID))
__UI_PrintString CaptionIndent, ((This.Height \ 2) - uspacing& \ 2), ThisTempText$
ELSE
__UI_PrintString CaptionIndent, ((This.Height \ 2) - uspacing& \ 2), TempCaption$
END IF