Recent

Author Topic: TEDit not firing OnChange when echoMode=emPassword  (Read 353 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 538
  • Tweaking4All.com
    • Tweaking4All
TEDit not firing OnChange when echoMode=emPassword
« on: October 09, 2019, 04:08:48 pm »
I'm not sure if this is expected behavior or not;


When using a TEdit to enter a password, the "OnChange" event never fires when "echoMode" is set to "emPassword".


The "OnKeyUp" event does fire just fine, so I use this as a workaround right now.


As I'm not sure if this is a bug or expected behavior, I figured I'll just ask here in the forum before reporting it as a bug.
Can anyone confirm either?

Zvoni

  • Full Member
  • ***
  • Posts: 236
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #1 on: October 09, 2019, 04:13:13 pm »
Cannot confirm.
Just started a new simple project, put a TEdit and a TLabel on the form, set echomode for Edit1 to emPassword and this as the OnChange-Event
Code: Pascal  [Select]
  1. procedure TForm1.Edit1Change(Sender: TObject);
  2. begin
  3.   label1.caption:=edit1.Text;
  4. end;    
the Label shows my Password in plain text while entering/modifying

EDIT: Upps. Just saw it was in SubForum "Cocoa", sooooo.....-----> No Idea!  :D
I'm on Windows right now
« Last Edit: October 09, 2019, 04:15:45 pm by Zvoni »
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircrafts

Hansaplast

  • Hero Member
  • *****
  • Posts: 538
  • Tweaking4All.com
    • Tweaking4All
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #2 on: October 09, 2019, 04:33:39 pm »
Haha, well, that's a good test though!  :D
Now I can guess it's NOT expected behaviour.
I just did the exact same thing under Cocoa and nothing happens when typing in the TEdit.


Thanks!

Bart

  • Hero Member
  • *****
  • Posts: 3518
    • Bart en Mariska's Webstek
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #3 on: October 09, 2019, 04:36:27 pm »
Please file a bugreport.

Bart

Hansaplast

  • Hero Member
  • *****
  • Posts: 538
  • Tweaking4All.com
    • Tweaking4All
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #4 on: October 09, 2019, 04:38:51 pm »
Thanks again!
Bug has been reported: bug 36158

Thaddy

  • Hero Member
  • *****
  • Posts: 8898
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #5 on: October 09, 2019, 07:46:56 pm »
OnKeyUp is not really a work-around: It is usually the better choice anyway... ;D 8-) O:-)

But it seems a bug, just remember the above.
(because the other options keep firing all the time and OnKeyUp fires only once per key press)
« Last Edit: October 09, 2019, 07:49:26 pm by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

rvk

  • Hero Member
  • *****
  • Posts: 3836
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #6 on: October 09, 2019, 10:17:38 pm »
(because the other options keep firing all the time and OnKeyUp fires only once per key press)
Does the OnChange-event happen all the time? More than the keypress-event???

Yes, it could also happen when you change the text in code (depending on the component) but isn't that what you want in some (or most) cases?

Thaddy

  • Hero Member
  • *****
  • Posts: 8898
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #7 on: October 09, 2019, 10:45:58 pm »
OnChange fires probably more than OnKeyUp, at least it does so less than OnKeyDown which everybody seems to consider a good choice... O:-) 8-) >:D Which it almost never is except for navigational purposes.
« Last Edit: October 09, 2019, 10:47:45 pm by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

Zvoni

  • Full Member
  • ***
  • Posts: 236
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #8 on: October 10, 2019, 08:12:50 am »
Is OnKeyUp/Down firing when you copy/paste Text into a TEdit?

EDIT: Just tested on Windows: KeyUp/Down fires for Copy/Paste (Probably for the pressing/releasing of CTRL and C/V)
It doesn't fire for KeyPress
« Last Edit: October 10, 2019, 08:19:41 am by Zvoni »
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircrafts

rvk

  • Hero Member
  • *****
  • Posts: 3836
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #9 on: October 10, 2019, 09:57:16 am »
Is OnKeyUp/Down firing when you copy/paste Text into a TEdit?

EDIT: Just tested on Windows: KeyUp/Down fires for Copy/Paste (Probably for the pressing/releasing of CTRL and C/V)
It doesn't fire for KeyPress
Yes, it's triggered bij the CTRL and V keys.
It is NOT triggered when someone paste it via mouse-actions.
It is also NOT triggered when the TEdit.Text is changed in code.

So if you want to do something when the TEdit.Text changes (keyboard, mouse or in code), you'll need to use OnChange.

Zvoni

  • Full Member
  • ***
  • Posts: 236
Re: TEDit not firing OnChange when echoMode=emPassword
« Reply #10 on: October 10, 2019, 10:13:26 am »
So if you want to do something when the TEdit.Text changes (keyboard, mouse or in code), you'll need to use OnChange.
Agreed. And as the OP posted: OnChange doesn't fire for him when in echomode=emPassword under Cocoa.
The classic experience: You register at a website, you get an E-Mail with your cryptic Password. You copy the password from the E-Mail, and paste it in the Textbox....
Or in OP's case a probable application: TEdit is in password-mode, and while the user enters his password, the OP tries to gauge, how "good" this password is, and he would need OnChange for that
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircrafts