Page 1 of 1
Listgadget Question
Posted: Sat Jul 24, 2010 10:07 am
by Krisko
Hi all I want to ask you if I have a listicongadget with two columns. The first is username and the second is password. How can I make the data in the second column to be hidden with something like #PB_String_Password, but only the second column. I'll be very grateful to your help

Re: Listgadget Question
Posted: Sat Jul 24, 2010 11:09 am
by Arctic Fox
This is just a simple approach.
Replace all the characters in the password string with asterisks when you specify the text for the second column.
Code: Select all
Procedure.s CreateString(Character$, Length)
Protected String$ = Space(Length)
ProcedureReturn ReplaceString(String$, " ", Character$)
EndProcedure
Dim Username$(2)
Dim Password$(2)
Username$(0) = "First"
Username$(1) = "Second"
Username$(2) = "Third"
Password$(0) = "First"
Password$(1) = "Second"
Password$(2) = "Third"
OpenWindow(0, 100, 100, 300, 300, "")
ListIconGadget(0, 5, 5, 290, 290, "Username", 120, #PB_ListIcon_FullRowSelect)
AddGadgetColumn(0, 1, "Password", 120)
For x = 0 To 2
AddGadgetItem(0, x, Username$(x))
SetGadgetItemText(0, x, CreateString("*", Len(Password$(x))), 1)
Next x
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Re: Listgadget Question
Posted: Sat Jul 24, 2010 11:32 am
by Krisko
Thanks man

Re: Listgadget Question
Posted: Sat Jul 24, 2010 11:44 am
by Arctic Fox
You're very welcome

Re: Listgadget Question
Posted: Sat Jul 24, 2010 12:53 pm
by PB
But don't use Len(Password$(x)) as that just helps crackers by telling them the password size.
Personally, if the password isn't meant to be seen, I wouldn't even use a ListIcon column for it.
What's the point? The user can't read it, so it serves absolutely no useful purpose at all.