InputBox with masked or white color text lazarus / 21-General ---------------------------------------------------------------------- Conte · 2021-10-04 19:39 I need an InputBox to enter a password. I'd like that the text is masked or in white color to not be seen. Is there a way to do that? PS: I can't use InputQuery cause the variable is a WideString and it gives me error. If you know a way to use a WideString in InputQuery the problem is solved cause I make TRUE the masked option. ---------------------------------------------------------------------- balazsszekely · 2021-10-04 19:51 Quote from: Conte on October 04, 2021, 09:39:37 pmI need an InputBox to enter a password. I'd like that the text is masked or in white color to not be seen. Is there a way to do that? PS: I can't use InputQuery cause the variable is a WideString and it gives me error. If you know a way to use a WideString in InputQuery the problem is solved cause I make TRUE the masked option. PasswordBox perhaps? ---------------------------------------------------------------------- Conte · 2021-10-04 20:36 You are great! PasswordBox works. I just found a problem though! It gives problem with 'if'. Look:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.btnConnClick(Sender: TObject);begin  Target:='DB1 Connection';  if CredReadGenericCredentials(Target, Username, Password) then    begin    ZConnection1.Database:='localhost';    ZConnection1.Hostname:='xe';    ZConnection1.User:=Username;    ZConnection1.Password:=Password;    zquery1.sql.text:='select * from test';    zquery1.open;    end else      Username:=InputBox('Title','Prompt', Username);      Password:=PasswordBox('Title','Prompt');      if CredWriteGenericCredentials(Target, Username, Password) then      ZConnection1.Database:='localhost';    ZConnection1.Hostname:='xe';  ZConnection1.User:=Username;    ZConnection1.Password:=Password;    Username:='';    Password:='';    zquery1.sql.text:='select * from test';    zquery1.open;    end;   It should work so: if credentials are already stored with that target name you login, instead you are asked username and password. Problem is that when I store username and password first time it works. If I close and open the application again and I click that button, I'm asked again for the password (not username though). Is this a bug or my faily if statement? Edit: yes it was my 'faily if'. Just corrected adding begin and end; after the else. -.-' Anyway I leave the code if you want to make more corrections. Always apreciated. ---------------------------------------------------------------------- Conte · 2021-10-04 21:53 I'd add another question about the InputBox that has a strange functioning. If I press 'Cancel' it enter a blank value instead of nothing (exiting). Is there a way to avoid that? ---------------------------------------------------------------------- balazsszekely · 2021-10-05 07:06 @conte Try attached project, but don't forget to change the values inside mainform's button1click. Tested with: Lazarus Trunk/FPC 3.2.2(32 bit), Windows 10(64 bit)