Windows 8 PasswordBox

Hello *,

in Windows 8 there is a new control named "PasswordBox", which has the 
option to reveal the typed password while clicking and holding an "eye" 
button inside the edit control.

PasswordBox Documentation:
http://msdn.microsoft.com/library/windows/apps/br227519

Screenshot here:
http://www.troublefixers.com/disable-password-reveal-button-in-ie/

I would like to have that PasswordBox as a delphi component. How could I 
start?

Is there an EditStyle (ES_xxx) to show this RevealButton?

I tried to use TButtonedEdit, but the buttons only have "OnClick" event 
while I would need OnMouseDown, OnMouseUp and OnMouseLeave event.

Any ideas?

TIA
Achim
0
Achim
12/3/2013 11:02:17 AM
public.delphi.vcl.writing 510 articles. 0 followers. Follow

4 Replies
1343 Views

Similar Articles

[PageSpeed] 46

Achim wrote:

> I would like to have that PasswordBox as a delphi component. How could
> I start?

You will not be able to use it in Delphi.  It is only available to Metro-style 
(Windows Store) apps via the WinRT API, which Delphi does not support (that 
is not Embarcadero's fault - Microsoft locked the WinRT API from being accessed 
by third-party compilers).

> Is there an EditStyle (ES_xxx) to show this RevealButton?

No.  But there is nothing stopping you from using your own button to assigning/removing 
the PasswordChar dynamically as needed.

> I tried to use TButtonedEdit, but the buttons only have "OnClick"
> event while I would need OnMouseDown, OnMouseUp and
> OnMouseLeave event.

The buttons of a TButtonedEdit are child controls of the TButtonedEdit, so 
you can directly access them using the TButtonedEdit's Controls[] array and 
assign your own event handlers to them as needed.  However, you will have 
to do it in code at run-time, not at design-time.

--
Remy Lebeau (TeamB)
0
Remy
12/3/2013 7:02:59 PM
Hello Remy,

Remy Lebeau (TeamB) wrote:
>
>> Is there an EditStyle (ES_xxx) to show this RevealButton?
>
> No.  But there is nothing stopping you from using your own button to assigning/removing
> the PasswordChar dynamically as needed.

That is what I want to achieve.

>> I tried to use TButtonedEdit, but the buttons only have "OnClick"
>> event while I would need OnMouseDown, OnMouseUp and
>> OnMouseLeave event.
>
> The buttons of a TButtonedEdit are child controls of the TButtonedEdit, so
> you can directly access them using the TButtonedEdit's Controls[] array and
> assign your own event handlers to them as needed.  However, you will have
> to do it in code at run-time, not at design-time.

Thank you for your suggestions.
Unfortunately that child controls are not really buttons (derived from 
TPersistent) but something which classname is 'TEditButton.TGlyph'.

I cannot typecast this controls TEditButton.TGlyph to anything useful; 
and this TGlyph is declared as strict private.

Looks like I need to find an other way or other component.

Achim
0
Achim
12/4/2013 9:58:59 AM
Achim wrote:

> That is what I want to achieve.

So what is stopping you?  TButtonedEdit has a public PasswordChar property, 
eg:

{code}
procedure TMyForm.ReveilPassButtonClick(Sender: TObject);
begin
  ButtonedEdit1.PasswordChar := #0;
end;

procedure TMyForm.HidePassButtonClick(Sender: TObject);
begin
  ButtonedEdit1.PasswordChar := '*';
end;
{code}

Or:

{code}
procedure TMyForm.ButtonedEdit1LeftButtonClick(Sender: TObject);
begin
  if ButtonedEdit1.PasswordChar = #0 then
    ButtonedEdit1.PasswordChar := '*'
  else
    ButtonedEdit1.PasswordChar := #0;
end;
{code}

Works fine when I try it.

> Unfortunately that child controls are not really buttons (derived from
> TPersistent)

Each button is represented by TEditButton, which derives directly from TPersistent. 
 However, the visible portion of TEditButton is represented by TGlyph, which 
is derived from TCustomControl.  Each TGlyph object has the TButtonedEdit 
set as its Parent, and thus is accessible via the button's Controls[] list 
at runtime.  The TButtonedEdit's OnLeftButtonClick and OnRightButtonClick 
property setters simply assign the user's event handlers directly to the 
corresponding TGlyph.OnClick event.  You can do the same thing manually for 
other TControl events, like OnMouseEnter and OnMouseLeave.

> I cannot typecast this controls TEditButton.TGlyph to anything useful;

Yes, you can, eg:

{code}
type
  TControlAccess = class(TControl)
  end;

procedure TMyForm.FormCreate(Sender: TObject);
begin
  with TControlAccess(ButtonedEdit1.Controls[0]) do // left button
  begin
    OnMouseEnter := ButtonMouseEnter;
    OnMouseLeave := ButtonMouseLeave;
  end;
end;

procedure TMyForm.ButtonMouseEnter(Sender: TObject);
begin
  // setting the TButtonedEdit.PasswordChar property recreates the TButtonedEdit 
window,
  // which indirectly recreates the TGlyph windows, which causes our OnMouse... 
event handlers
  // to be lost!  So using the Win32 API directly instead...

  //ButtonedEdit1.PasswordChar := #0;
  SendMessage(ButtonedEdit1.Handle, EM_SETPASSWORDCHAR, 0, 0);
  ButtonedEdit1.Invalidate;
end;

procedure TForm54.ButtonMouseLeave(Sender: TObject);
begin
  // setting the TButtonedEdit.PasswordChar property recreates the TButtonedEdit 
window,
  // which indirectly recreates the TGlyph windows, which causes our OnMouse... 
event handlers
  // to be lost!  So using the Win32 API directly instead (which has the 
side effect of losing the
  // nice themed dots, unfortunately)...

  //ButtonedEdit1.PasswordChar := '*';
  SetWindowLongPtr(ButtonedEdit1.Handle, GWL_STYLE, GetWindowLongPtr(ButtonedEdit1.Handle, 
GWL_STYLE) or ES_PASSWORD);
  SendMessage(ButtonedEdit1.Handle, EM_SETPASSWORDCHAR, Ord('*'), 0);
  ButtonedEdit1.Invalidate;
end;
{code}

> and this TGlyph is declared as strict private.

Yes, but you don't need to access the TGlyph *class* itself, only the TGlyph 
*objects*, and those are publically accessible via the button's Controls[] 
list.

--
Remy Lebeau (TeamB)
0
Remy
12/4/2013 7:45:13 PM
Hello Remy,

Remy Lebeau (TeamB) wrote:

> procedure TMyForm.FormCreate(Sender: TObject);
> begin
>   with TControlAccess(ButtonedEdit1.Controls[0]) do // left button
>   begin
>     OnMouseEnter := ButtonMouseEnter;
>     OnMouseLeave := ButtonMouseLeave;
>   end;
> end;

[...]

That works; Thank you very much!

Achim
0
Achim
12/5/2013 8:55:49 AM
Reply:

Similar Artilces:

Delphi Program Running Under Windows 8 vs. Windows 7
If a program, created with D2007, runs fine under Windows 7, it should run under Windows 8, correct? It's basically the same Intel architecture, right? The program created with D2007 does nothing fancy - I'm no professional programmer. Installation may be slightly different - i.e., the installation program may need some modifying I assume, to install under Windows 8. I don't have Windows 8 right now, I'm just trying to gather some information for a client. Thanks Your program won't run only on Windows RT (ARM version of windows). On all other versio...

How about Delphi for Windows 8?
<BG> CB > {quote:title=Charles B wrote:}{quote} > <BG> > > CB My first Win8 test report: business customers will like this "new" "OS". iWindows8! iStupid! iGnore iT! Frankly, Windows 8 is already the past. I guess we should ask what about Delphi for Windows 9, 10, and the next secret version as well. Charles B wrote: > <BG> > > CB The press release said something about a new inter-application interface, that will make it easier to include e.g. pictures from various sources in your email. Dunno if that mean...

Windows 8+ and Delphi
OK, let me get this clear. With all the discussions on Windows 8 and beyond, and HTML5/JS seemingly doing all the work, we will be needing a programming language to code the backend, right? I mean, if not, then Delphi/C++Builder will cease to exist by the time Windows 8 arrives... "Jennifer-Ashley Kuiper" <jennifer@maindevelopment.com> wrote in message news:372999@forums.embarcadero.com... > OK, let me get this clear. With all the discussions on Windows 8 and > beyond, and HTML5/JS seemingly doing all the work, we will be needing a > programming language...

Delphi XE2 and Windows 8
Are there any issues running Delphi XE2 in Windows 8 ? Google searches have given me nothing. Aware that I can't use Windows 8 features in XE2, just want to be able to continue running XE2 and developing/testing Windows XP -> WIndows 7 applications ? Thanks. > {quote:title=Christopher Burke wrote:}{quote} > Are there any issues running Delphi XE2 in Windows 8 ? > > Google searches have given me nothing. > > Aware that I can't use Windows 8 features in XE2, just want to be able to > continue running XE2 and developing/testing Windows XP -&...

Delphi and Windows 8 (Metro)
I am beta testing the windows 8 platform. With all the Metro style abilities for touch? Would that require some change out of the existing application development.... According to MS news, the VS11 would support the metro templates as a default.. What does it mean delphi wise? On 9/17/2011 10:31 AM, Amit Bueno wrote: > According to MS news, the VS11 would support the metro templates as a > default.. > What does it mean delphi wise? Its going to require some work. Probably XE3 even... -- "Programming is an art form that fights back" IntraWeb IRC and W...

Delphi 2010 and Windows 8
I was going to update to Windows 8 when it comes out but when I ran the compatibilty test on my computer it said Delphi 2010 was not compatible. Does anybody know if this is a real problem ? ...

Windows 8 Application with Delphi
Hi all: With the release of MS windows 8 beta today, is it possible to create Metro style (with Touch interface) applications with Delphi? Is there a beta version of Delphi you would need for this? Thanks Bob Bob McKinnon wrote: > Is there a beta > version of Delphi you would need for this? If anybody answered this question Embarcadero would have to kill them. ;-) -- Andy Syms Technosoft Systems Ltd "Real knowledge is to know the extent of one's ignorance." -- Confucius So is visual studio my best bet? I believe they have a beta versio...

Migrating all Delphis from Vista to Windows 8
Imagine you have Delphi 5, Delphi 2010, and Delphi XE2 on your Vista development machine. You want to upgrade to Windows 8.1. From what I gather, the MS upgrade procedure will just dump everything in the bit bucket in the sky and all applications need to be re-installed. Imagine you don't want to spend a week or two re-installing everything and you're not using any VM. How would you go about it? The best I can find is CnPack's IDE config backup/restore. Anyone tried it with this? For all other applications that use the registry, any reliable registry migration uti...

VCL Dimension Changes with Windows 8
All of my apps have been created under Windows 7 and earlier. I'm finding problems when running some of the apps under Windows 8. One of the most perplexing problems is dimension differences. When I load a particular project in XE4 using W7, I find that some objects have different dimensions than when loaded in XE4 using W8. Examples (in pixels): A project's form: W7: 634H x 881W W8: 826H x 1150W TPanel: W7: 441H x 593W W8: 577H x 776W TBevel: W7: 425H x 577W W8: 556H x 755W I've simply loaded the same project (created under W7) in XE4 in both W7 and ...

Windows 8 WinRT & Delphi
Gartner predicts Tablet sales to total 119 million units in 2012, a 98 percent increase from 2011. They predict 2013 sales to be 182 Million units, a 53% increase from 2012. Whatever figures you believe, the Tablet market is HUGE and growing VERY quickly over the next few years. Windows 8 tablets running WinRT will be a significant player in this market. They are in the shops in 2 months. It has JUST been publicly made clear that Delphi developers will NOT be able to develop WindowsRT applications for this market using XE3. Note: this is via newsgroups from Allen Bauer https://forum...

Buying a new Windows 8.1 laptop with Windows 8.1 installed
When buying a new laptop from one of the major manufacturers, like Dell or Lenovo, with Windows 8.1 installed, is it possible to set it up with just a Local Account and not a Microsoft Account? -- Chris On 11/2/2013 11:28 AM, Chris wrote: > When buying a new laptop from one of the major > manufacturers, like Dell or Lenovo, with Windows 8.1 > installed, is it possible to set it up with just a Local > Account and not a Microsoft Account? Yes, look here; http://www.techrepublic.com/blog/windows-and-office/quick-tip-change-to-a-local-account-in-windows-81/ On 11/2/201...

Windows 8 compability of Delphi 2010
Do you guys know if Delphi 2010 is compatible with Windows8 32bit or Windows8 64bit? Upgrade dialog states hey are no compatible. Thomas Schulz wrote: > Do you guys know if Delphi 2010 is compatible with Windows8 32bit or Windows8 64bit? Upgrade dialog states hey are no compatible. > Windows 8 did not exist when Delphi 2010 was released, so it is untested and never will be. Most likely, it will just work. If that's good enough, then go for it. If you want something we stand behind, you need XE3. > Windows 8 did not exist when Delphi 2010 was released, so it is untested ...

Delphi XE application on Windows 8
Hi, I am using Delphi XE to develop my application. The app runs fine on XP, Vista and Win7. When it is run on Win8, however, the user says that the app always starts up with a small form size so he has to re-size it each time before he can use it. He also says that if he runs it in XP Compatibility Mode then it starts ok with the correct form size. I've tried setting the main form height and width in the OnActivate event but this makes no difference. It seems that the user can re-size the app but the app cannot re-size itself! I don't have a Win8 machine yet to test this myself...

Delphi XE2 in Windows 8.1
I have Delphi XE2 installed on Windows7 and it works fine. Now I installed Delphi XE2 also on Windows 8.1, and it compiles fine as 32 and also as 64 bit, but when try to run 64 bit application I can run it only without debugging (Shift+Ctrl+F9) but when I select Run (F9) Delphi reports error: Disconnected session, (or something very similar). Running 32 bit applications works without problems in both ways. Any help would be appreciated. Andrej > {quote:title=Andrej Mrvar wrote:}{quote} > I have Delphi XE2 installed on Windows7 and it works fine. > > Now I insta...

Web resources about - Windows 8 PasswordBox - public.delphi.vcl.writing

Free Password Manager - PasswordBox
PasswordBox gets passwords off your mind. Say goodbye to multiple usernames and passwords. Your PasswordBox master password is the only one you'll ...

PasswordBox - CrunchBase Profile
PasswordBox® is the world's first digital life manager. It is a free service that allows users to securely store, retrieve

PasswordBox FREE Password Manager & Wallet on the App Store on iTunes
Get PasswordBox FREE Password Manager & Wallet on the App Store. See screenshots and ratings, and read customer reviews.

PasswordBox Buys Legacy Locker
PasswordBox , the password management tool that recently raised funding , has required Legacy Locker , a five-year-old service that allows people ...

Intel acquires 1Password competitor PasswordBox for its Security Group
Intel has announced that it has acquired PasswordBox , the Montreal-based password management startup that competes with the likes of 1Password ...

Intel acquires password management solution PasswordBox
Having a strong and unique password for every website you visit is a great idea. Unfortunately, there is a major problem with that it can be ...

Intel Acquires PasswordBox, an Award-Winning Digital Identity Manager
Today, Intel announced the acquisition of PasswordBox&reg;, a Montreal-based and award-winning provider of a cross-platform identity management ...

Intel buys PasswordBox to bolster security tools
Intel buys PasswordBox to bolster security tools

PasswordBox 1-Tap Stores Log-In Info Across Multiple Apps
PasswordBox's Chrome-based log-in solution is now available as a free app that works across all "devices, platforms and mobile applications." ...

Facebook Vice Presidents Bet On PasswordBox
Montreal-based password security firm, PasswordBox, recently announced a $6 million round of funding and some of that cash came from two executives ...

Resources last updated: 2/14/2016 2:31:02 AM