Textbox Password Property ...

Moderator: Rathinagiri

User avatar
hmgchang
Posts: 240
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 1 time
Been thanked: 4 times

Textbox Password Property ...

Post by hmgchang »

Dear Masters,

The Password property of the TextBox control can be set as .T. or .F. when we defined/designed...
But i get an error saying syntax error while tried to change :
Main.txtPass.Password := .T.

or are there any other ways to alter the property ?

TIA


best rgds,
Chang
Just Hmg It !

User avatar
andyglezl
Posts: 1251
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 39 times
Been thanked: 107 times
Contact:

Post by andyglezl »

No entiendo el porque quieres alterar esta propiedad, o es Texbox "normal" ó para "Password".
Creo que solo lo puedes hacer al momento de la definición.
En la lista de propiedades no aparece esta propiedad.
---------------------------------------------------------------------------------------------------------------
I do not understand why you want to alter this property or is "normal" or to "Password" TexBox.
I think you can only do when the definition.
In the list of properties this property does not appear.

Code: Select all

      DEFINE TEXTBOX <Controlname>
            ........
            PASSWORD <lValue> 
            ........
      END TEXTBOX
Properties:
- Value
- Enabled
- Visible
- Row
- Col
- Width
- Height
- FontName
- FontSize
- FontBold
- FontItalic
- FontUnderline
- FontStrikeout
- ToolTip
- BackColor
- FontColor
- DisabledBackColor
- DisabledFontColor
- CaretPos
- ReadOnly
- Name (R)
- TabStop (D)
- Field (D)
- Parent (D)
- InputMask (D)
- Format (D)
- MaxLength (D)
- RightAlign (D)
- HelpId (D)
- CaseConvert (D)
- DataType (D)

D: Available at control definition only
R: Read-Only
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
hmgchang
Posts: 240
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 1 time
Been thanked: 4 times

Post by hmgchang »

Thks for your info, but...
passwordproperty.JPG
passwordproperty.JPG (10.4 KiB) Viewed 4731 times
so... if the checkbox is checked...
then i need to display the password entered at the textbox...
my idea is to just set the password property to .F.

and when the checkbox is unchecked... then
Main.txtPass.Password := .T.

but it wont compile.....

pls advise n TIA

best rgds
Chang
Just Hmg It !

User avatar
serge_girard
Posts: 2584
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 865 times
Been thanked: 161 times
Contact:

Post by serge_girard »

Chang,

I believe it has been hardcoded in order to avoid to see passwords.

Serge

User avatar
mol
Posts: 3409
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 268 times
Been thanked: 173 times
Contact:

Post by mol »

Against creating checkbox Show password and display eneted password in Password field, you can create something like in widows 8 - picture with eye, when you go to this picture, the password will show in balloon.

User avatar
gfilatov
Posts: 765
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 31 times
Been thanked: 405 times
Contact:

Post by gfilatov »

hmgchang wrote:...
then i need to display the password entered at the textbox...
my idea is to just set the password property to .F.

and when the checkbox is unchecked... then
Main.txtPass.Password := .T.
Hi Chang,

Please be so kind to review the following simple sample:

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
*/

#include "minigui.ch"

FUNCTION Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 300 ;
		TITLE "MiniGUI Password Demo" ;
		MAIN ;
		FONT "Arial" SIZE 10 

	MakePasswordControl( 'Secret', .T. )

	@ 40,10 CHECKBOX Check_1 CAPTION 'Show password' ;
		VALUE .F. ;
		WIDTH 120 ;
		TOOLTIP 'CheckBox Control' ;
		ON CHANGE MakePasswordControl( Form_1.Text_pass.Value, ! Form_1.Check_1.Value )

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

RETURN Nil


FUNCTION MakePasswordControl( cPass, lShow )

	IF IsControlDefined (Text_pass, Form_1) == .T.
		Form_1.Text_pass.Release
	ENDIF

	DEFINE TEXTBOX Text_pass
		PARENT   Form_1
		ROW	 10
		COL	 10
		VALUE    cPass
		PASSWORD lShow
		FONTNAME "Arial"
		FONTSIZE 10
		TOOLTIP  'Password TextBox' 
		MAXLENGTH 16 
	END TEXTBOX

RETURN lShow
Hope that useful :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

PeteWG
Posts: 163
Joined: Sun Mar 21, 2010 5:45 pm
Has thanked: 15 times
Been thanked: 56 times

Post by PeteWG »

Hi Chang,

as already stated, PASSWORD property isn't available/changeable at runtime.
However you can achieve what you're looking for with various tricks like this one posted by Grigory.
below is an other approach which you might consider.

Code: Select all

#include "minigui.ch"

FUNCTION Main

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 120 ;
      TITLE "Show/hide Password" ;
      MAIN ;
      FONT "Arial" SIZE 10

   DEFINE TEXTBOX Pass_Shown
      PARENT   Form_1
      ROW    30
      COL    70
      VALUE  ""
      FONTNAME "Arial"
      FONTSIZE 10
      MAXLENGTH 16
		INVISIBLE .T.
   END TEXTBOX		
		
   DEFINE TEXTBOX Pass_Hidden
      PARENT   Form_1
      ROW    30
      COL    70
      VALUE    ""
      PASSWORD .T.
      FONTNAME "Arial"
      FONTSIZE 10
      TOOLTIP  'Password TextBox'
      MAXLENGTH 16
   END TEXTBOX		
		
   @ 33,200 CHECKBOX Check_1 CAPTION 'Show password' ;
      VALUE .F. ;
      WIDTH 120 ;
      TOOLTIP 'CheckBox Control' ;
      ON CHANGE ShowPassWord( This.Value )

   END WINDOW
   
	CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

RETURN Nil

PROCEDURE ShowPassWord( lShow )
	IF lShow
		Form_1.Pass_Shown.Value := Form_1.Pass_Hidden.Value
		DoMethod( 'Form_1', 'Pass_Hidden', 'Hide' )
		DoMethod( 'Form_1', 'Pass_Shown', 'Show' )
	ELSE
		Form_1.Pass_Hidden.Value := Form_1.Pass_Shown.Value
		DoMethod( 'Form_1', 'Pass_Hidden', 'Show' )
		DoMethod( 'Form_1', 'Pass_Shown', 'Hide' )
	ENDIF

	RETURN
rgrds,
Pete

Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar »

Hola PeteGW,

Existe la propiedad:

INVISIBLE .T. en HMG? que versión usas?

Saludos

Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar »

Hola Chang,

Yo lo hago así:

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
*/

#include "minigui.ch"

FUNCTION Main

LOCAL cPass := "Secret"

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 300 ;
      TITLE "MiniGUI Password Demo" ;
      MAIN ;
      FONT "Arial" SIZE 10 

   DEFINE TEXTBOX Text_pass
      PARENT   Form_1
      ROW    10
      COL    10
      VALUE    cPass
      PASSWORD .T.
      FONTNAME "Arial"
      FONTSIZE 10
      TOOLTIP  'Password TextBox' 
      MAXLENGTH 16 
   END TEXTBOX
   
   DEFINE TEXTBOX Text_NoPass
      PARENT   Form_1
      ROW    10
      COL    10
      VALUE    cPass
      PASSWORD .F.
      FONTNAME "Arial"
      FONTSIZE 10
      TOOLTIP  'Password TextBox' 
      MAXLENGTH 16 
   END TEXTBOX   

   @ 40,10 CHECKBOX Check_1 CAPTION 'Show password' ;
      VALUE .F. ;
      WIDTH 120 ;
      TOOLTIP 'CheckBox Control' ;
      ON CHANGE Cambia(This.Value)

   END WINDOW
   
   Form_1.Text_NoPass.Hide

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

RETURN Nil


FUNCTION Cambia(lValue)

   IF lValue == .F.
		Form_1.Text_NoPass.Hide
		Form_1.Text_pass.Show
	ELSE
		Form_1.Text_pass.Hide
		Form_1.Text_NoPass.Show
   ENDIF

RETURN 
Saludos
Last edited by Javier Tovar on Thu Nov 27, 2014 8:38 pm, edited 2 times in total.

PeteWG
Posts: 163
Joined: Sun Mar 21, 2010 5:45 pm
Has thanked: 15 times
Been thanked: 56 times

Post by PeteWG »

Javier Tovar wrote:Hola PeteGW,

Existe la propiedad:

INVISIBLE .T. en HMG? que versión usas?

Saludos
Hi Havier

INVISIBLE property last time i looked at 3.3.1. docs, was there. You mean it doesn't work? ( I didn't test with HMG, though)
I do use both HMG & Mingui extended.

PS. btw, your sample you posted needs some edit. check it and i'm sure you'll find what i mean. ;-)
rgrds,
Pete

Post Reply