
Listgadget Question
Listgadget Question
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 

- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Listgadget Question
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.
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
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Listgadget Question
You're very welcome 

Re: Listgadget Question
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.
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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.