Data Access Worldwide Knowledge Base
Article ID 2256 Article Title HOWTO: How to make password state work on a text edit control Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2256 KBase Category VDF11 Date Created 11/06/2006 Last Edit Date 11/14/2006
Article Text
QUESTION:
I want to hide the contents of the controls when the user is not allowed to see the data. I thought about replacing the data with '*' characters. So I used password_state on the dbForms. This works fine but how do I do this with a cTextEdit control?
ANSWER:
While the control does not have a build in password_state property we can easily add it to the subclass by implementing the following code:
Class cPWDTextEdit Is A cTextEdit
Procedure Construct_Object
Forward Send Construct_Object
Property Boolean private_pbPassword False
End_Procedure // Construct_Object
Procedure SetPasswordState Boolean bState
Handle hWnd
Get Window_Handle to hWnd
If (hWnd > 0) Begin
Send Page_Object False
End
Set Window_Style to ES_PASSWORD bState
If (hWnd > 0) Begin
Send Page_Object True
End
Set private_pbPassword to bState
End_Procedure // SetPasswordState
Procedure TogglePassword
Boolean bState
Get private_pbPassword to bState
Move (not (bState)) to bState
Send SetPasswordState bState
End_Procedure
End_Class
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.