Password Style and FireTextBox

Started by Sean Roe, April 20, 2011, 02:31:49 PM

Previous topic - Next topic

Sean Roe

This control is great, however I wanted to set up this text box to display characters over the top of the typed in password.

I found this code you wrote for FF2 which works great:
Sub AddStyleToControl (hCtrl As Long, StyletoAdd As Long)
    '   AddStyleToControl HWND_FORM1_TEXT1, %ES_PASSWORD
    '   
    '   ' 42 is the ascii value for asterisk "*"
    '   SendMessage HWND_FORM1_TEXT1, %EM_SETPASSWORDCHAR, 42, 0
    '   FF_Control_Redraw HWND_FORM1_TEXT1
  SetWindowLong hCtrl, %GWL_STYLE, (GetWindowLong (hCtrl,%GWL_STYLE) Or StyleToAdd)
End Sub

Sub RemoveStyleFromControl (hCtrl As Long, StyletoRemove As Long)
    '   RemoveStyleFromControl HWND_FORM1_TEXT1, %ES_PASSWORD
    '
    '   ' Remove the password character as well by setting it to null
    '   SendMessage HWND_FORM1_TEXT1, %EM_SETPASSWORDCHAR, 0, 0
    '   FF_Control_Redraw HWND_FORM1_TEXT1
  SetWindowLong hCtrl, %GWL_STYLE, (GetWindowLong (hCtrl,%GWL_STYLE) And (Not StyleToRemove))
End Sub


I was wondering if you could add an option for FireTextBox to have different styles especially one for hiding the password. I moved some of your code around and created some functions to specifically deal with setting the password style.
Sub AddPasswordStyleToControl (hCtrl As Long)
   
  SetWindowLong hCtrl, %GWL_STYLE, (GetWindowLong (hCtrl,%GWL_STYLE) Or %ES_PASSWORD)
  '42 is the ascii value for asterisk "*" , 7 is a black circle
  SendMessage hCtrl, %EM_SETPASSWORDCHAR, 7, 0
  FF_Control_Redraw hCtrl
End Sub
Sub RemovePasswordStyleFromControl (hCtrl As Long)
   
  SetWindowLong hCtrl, %GWL_STYLE, (GetWindowLong (hCtrl,%GWL_STYLE) And (Not %ES_PASSWORD))
  ' Remove the password character as well by setting it to null
  SendMessage hCtrl, %EM_SETPASSWORDCHAR, 0, 0
  FF_Control_Redraw hCtrl
End Sub


I did a search but couldn't find anything done yet with this in FF3. Or is there another way to do this in FF3?

Thanks!