Recent

Author Topic: TMaskEdit and TCanvas.Brush  (Read 33954 times)

Bart

  • Hero Member
  • *****
  • Posts: 5561
    • Bart en Mariska's Webstek
Re: TMaskEdit and TCanvas.Brush
« Reply #30 on: May 24, 2011, 12:49:49 pm »
Before you do that (and file a bugreport) please test the following scenario:

in OI:
- MaskEdit1.EditMask = '';  //empty mask
- MaskEdit1.Text := ''; //no text

Build and run as normal user.
Set focus to MaskEdit1 and type '12345'

How many times do you see TCustomMaskEdit.KeyPress debug output in the console?

If you don't see the KeyPress debug output for one or more of the keys, run the app as root and repeat the process.

Also, to determine if this is caused by changing text in TextChanged, do the following:

in OI
- MaskEdit1.EditMask = '';  //empty mask
- MaskEdit1.Text = ''; //no text
- MaskEdit1.CharCase = ecUpperCase;

This will force the text in the control to be changed to uppercase, and this happens in TCustomEdit.TextChanged.

Build and run as normal user.
Set focus to MaskEdit1 and type 'abcde' (lower case)

How many times do you see TCustomMaskEdit.KeyPress debug output in the console?

If you don't see the KeyPress debug output for one or more of the keys, run the app as root and repeat the process.

Bart

gitspielen

  • New Member
  • *
  • Posts: 19
Re: TMaskEdit and TCanvas.Brush
« Reply #31 on: May 25, 2011, 08:03:08 am »
Before you do that (and file a bugreport) please test the following scenario:

in OI:
- MaskEdit1.EditMask = '';  //empty mask
- MaskEdit1.Text := ''; //no text

Build and run as normal user.
Set focus to MaskEdit1 and type '12345'

How many times do you see TCustomMaskEdit.KeyPress debug output in the console?
Code: [Select]
user@ubuntu:~/maskedit$ ./project1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text =
TCustomMaskdit.KeyPress: Key = 1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 1
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 12
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 123
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 1234
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 12345
OnChange
user@ubuntu:~/maskedit$
Huh? Weird. It's only one time.

And sudo it:
Code: [Select]
user@ubuntu:~/maskedit$ sudo ./project1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text =
TCustomMaskdit.KeyPress: Key = 1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 1
OnChange
TCustomMaskdit.KeyPress: Key = 2
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 12
OnChange
TCustomMaskdit.KeyPress: Key = 3
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 123
OnChange
TCustomMaskdit.KeyPress: Key = 4
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 1234
OnChange
TCustomMaskdit.KeyPress: Key = 5
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = 12345
OnChange
user@ubuntu:~/maskedit$
Exactly five times.


Quote
Also, to determine if this is caused by changing text in TextChanged, do the following:

in OI
- MaskEdit1.EditMask = '';  //empty mask
- MaskEdit1.Text = ''; //no text
- MaskEdit1.CharCase = ecUpperCase;

This will force the text in the control to be changed to uppercase, and this happens in TCustomEdit.TextChanged.

Build and run as normal user.
Set focus to MaskEdit1 and type 'abcde' (lower case)

How many times do you see TCustomMaskEdit.KeyPress debug output in the console?

If you don't see the KeyPress debug output for one or more of the keys, run the app as root and repeat the process.

Bart


As a normal user:
Code: [Select]
user@ubuntu:~/maskedit$ ./project1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text =
TCustomMaskdit.KeyPress: Key = a
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = a
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = A
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = A
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = Ab
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = AB
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = AB
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABc
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABC
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABC
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCd
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCD
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCD
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDe
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDE
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDE
OnChange

With root permission:
Code: [Select]
user@ubuntu:~/maskedit$ sudo ./project1
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text =
TCustomMaskdit.KeyPress: Key = a
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = a
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = A
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = A
OnChange
TCustomMaskdit.KeyPress: Key = b
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = Ab
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = AB
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = AB
OnChange
TCustomMaskdit.KeyPress: Key = c
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABc
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABC
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABC
OnChange
TCustomMaskdit.KeyPress: Key = d
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCd
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCD
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCD
OnChange
TCustomMaskdit.KeyPress: Key = e
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDe
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDE
OnChange
OnChange
TCustomMaskEdit.TextChanged: IsMasked = False FChangeAllowed = False Current Text = ABCDE
OnChange
user@ubuntu:~/maskedit$

Eh?

Bart

  • Hero Member
  • *****
  • Posts: 5561
    • Bart en Mariska's Webstek
Re: TMaskEdit and TCanvas.Brush
« Reply #32 on: May 25, 2011, 10:57:48 am »
OK, so you identified the problem.
KeyPress is not called after the first Key anymore.

See: problem for TEdit onKeyPress event in Ubuntu 11.04 topic also.

I'll post it on Mantis.

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5561
    • Bart en Mariska's Webstek
Re: TMaskEdit and TCanvas.Brush
« Reply #33 on: May 25, 2011, 11:18:04 am »
Filed a bugreport on mantis: http://bugs.freepascal.org/view.php?id=19413.

Can you please leave your comment on the bugtracker confirming the issue (otherwise it might be dismissed as "cannot reproduce").
(You need to have (or create) an account for this, don't let that hold you back please.)

Bart


Bart

  • Hero Member
  • *****
  • Posts: 5561
    • Bart en Mariska's Webstek
Re: TMaskEdit and TCanvas.Brush
« Reply #34 on: May 25, 2011, 11:32:29 am »
@gitspielen: KeyPress is ultimately derived from TWinControl.

Can you test OnKeyPress events from other TWinControl descendants (TForm springs to mind), and post the findings in the bugtracker?

Bart


Bart

  • Hero Member
  • *****
  • Posts: 5561
    • Bart en Mariska's Webstek
Re: TMaskEdit and TCanvas.Brush
« Reply #35 on: November 20, 2011, 11:15:44 pm »
@gitspielen: Ludo Brands reproted this issue being gone after updating his Ubuntu (see the bugtracker). Do you still have this issue?

Bart

 

TinyPortal © 2005-2018