Listgadget Question

Just starting out? Need help? Post your questions and find answers here.
Krisko
User
User
Posts: 22
Joined: Tue Jun 08, 2010 11:03 pm

Listgadget Question

Post 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 :)
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: Listgadget Question

Post 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
Krisko
User
User
Posts: 22
Joined: Tue Jun 08, 2010 11:03 pm

Re: Listgadget Question

Post by Krisko »

Thanks man :) 8)
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: Listgadget Question

Post by Arctic Fox »

You're very welcome :)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Listgadget Question

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