View Issue Details

IDProjectCategoryView StatusLast Update
0026865LazarusLCLpublic2015-05-17 13:35
ReporterZex AtillaAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindowsOS VersionWindows 7
Product Version1.2.6Product Build 
Target Version1.4Fixed in Version1.4 
Summary0026865: Some important TMaskEdit methods don't work anymore
DescriptionSeems that some of the virtual methods of TCustomEdit aren't virtual anymore. Code that worked perfectly in previous versions (1.2.0) now fails. See the example below, or the attached project.
Steps To Reproduceprocedure CustomEdit_WriteTime (ctl: TCustomEdit);
// this function doesn't work properly when ctl is TMaskEdit
const
  EDIT_MASK = '99\:99\:99;1;0';
  EDIT_TEXT = '00:02:25';
begin
  if (ctl is TMaskEdit) then
    (ctl as TMaskEdit).EditMask := EDIT_MASK;
  // instead of the specified text displays all zeros
  ctl.Text := EDIT_TEXT;
end;
TagsNo tags attached.
Fixed in Revisionr46593
LazTarget1.4
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0026924 closedBart Broersma TDBEdit keeps its text even when the dataset is closed 
related to 0027958 resolvedBart Broersma The DBEdits do not works with the EditMask 

Activities

Zex Atilla

2014-10-15 19:40

reporter  

test_bug.zip (129,366 bytes)

Bart Broersma

2014-10-15 23:18

developer   ~0078261

Not tested anything yet, but the changes between trunk and 1.2.0 wrt maskedit are:
- r43985: TCustomEdit: Dont set Modified to True in TextChanged when text is set by code. (Issue 0025666)
- r46338: LCL: Publish events OnMouseWheel, OnMouseWheelDown and OnMouseWheelUp for yet more controls. Issue 0026781

Not sure how this could break behaviour you described.

Could you please find the revision that worked?

Bart Broersma

2014-10-15 23:36

developer   ~0078263

TControl.SetText is not virtual, so this cannot be overridden, this is why MaskEdit has re-introduced a property Text with it's own getter/setter.
Setting TCustomEdit.Text will therefore call TCustomEdit.SetText, which is why your code does not produce the expected result.
However, this has been so since at least r18192 (when I completely re-implemented TMaskEdit) in 2009 (in the pre-1.0 era).

Zex Atilla

2014-10-16 18:59

reporter   ~0078281

You're right. I used a workaround in the previous version of our software, that's why I thought it worked. It didn't.

BTW, what's the reason that TControl.SetText isn't virtual?

Bart Broersma

2014-10-16 20:35

developer   ~0078284

> BTW, what's the reason that TControl.SetText isn't virtual?
Don't know. Is it virtual+protected in Delphi?

To get this to work, I think I need to override either RealSetText or SetTextBuf.
It'll take a while.

For the time being, you can workaround it by explicitely casting to TCustomMaskEdit.

Bart Broersma

2014-10-18 15:10

developer   ~0078344

Please test and close if OK.

Issue History

Date Modified Username Field Change
2014-10-15 19:40 Zex Atilla New Issue
2014-10-15 19:40 Zex Atilla File Added: test_bug.zip
2014-10-15 22:13 Jesus Reyes Assigned To => Bart Broersma
2014-10-15 22:13 Jesus Reyes Status new => assigned
2014-10-15 23:18 Bart Broersma Note Added: 0078261
2014-10-15 23:18 Bart Broersma LazTarget => -
2014-10-15 23:18 Bart Broersma Status assigned => feedback
2014-10-15 23:36 Bart Broersma Note Added: 0078263
2014-10-16 18:59 Zex Atilla Note Added: 0078281
2014-10-16 18:59 Zex Atilla Status feedback => assigned
2014-10-16 20:35 Bart Broersma Note Added: 0078284
2014-10-18 15:10 Bart Broersma Fixed in Revision => r46593
2014-10-18 15:10 Bart Broersma LazTarget - => 1.4
2014-10-18 15:10 Bart Broersma Note Added: 0078344
2014-10-18 15:10 Bart Broersma Status assigned => resolved
2014-10-18 15:10 Bart Broersma Fixed in Version => 1.4
2014-10-18 15:10 Bart Broersma Resolution open => fixed
2014-10-18 15:10 Bart Broersma Target Version => 1.4
2014-10-22 16:46 Stephano Relationship added related to 0026924
2015-05-17 13:35 Luiz Americo Relationship added related to 0027958