Bug in TWebEdit with weFloat (Urgent)

There is a major issue with TWebEdit when the EditType is set to weFloat.

With the latest version (not sure how far back the issue goes) this acts as if weNumber (integer) has been set. Basically, it won't accept '.', i.e 16.99 cannot be enterable. I must admit I haven't even tested this when I have updated Webcore, so unfortunately it was the client that discovered it.

It is working with RTL version: 20006 (showing WEBCOREVERSION = "1.9.1.0 Sentina")

it's not working with version: 20301 (showing WEBCOREVERSION = "2.0.0.0 Sentina", but actually compiled with 2.0.2.0).

Steps to reproduce:

  1. drop a TWebEdit on a form
  2. Set it's EditType to weFloat
  3. Compile and run

A quick fix would be appreciated, thanks.

We are able to reproduce this, but still need to allocate time to look for a solution.

I ran in something similar because I need to do a better masking of the input typed, since the pattern property does not block actively any input, so I made my own function, WIP. Thanks to your post I realized the problem is probably not in my code.

Symptoms: Strangely, the WebEdit is reporting an 'n' is pressed (instead of the period '.' ) as Achar in the keypress event. That is why in my function, the period does not return true
On the test I do write the key pressed to console, and clearly I pressed period but the console reports as if I pressed the lower capital n. Also in the log I pressed the apostrophe and the system seems to have received a number four, so it adds it to the input received. The semicolon reports correctly.

This is a screenshot and my code, very similar to the internal code in WebCore editType: I did input test123.50<'8. Note in the console that the comma is passed internally as the '1/4' symbol.
Even though the "reported" char is incorrect, the one passed to the edit is the correct one. Example: I press the period, the keypress reads an 'n' but passes the period to the control. The Onkeypress gets confused.

EDIT: am using VSC, not Delphi.

function validateInputType(inputType: string; Achar:char):boolean;
var Fresult: boolean;
begin
// default to true
Fresult := true;
asm
console.log(Achar);
end;
if inputType = 'jdFloat' then
begin
if not( Achar in ['0'..'9','n'] )
then Fresult := false;
end
Else
if inputType = 'onlyletters' then
if not (Achar in ['a'..'z','A'..'Z'] )
then Fresult := false;

result := Fresult;
end;

procedure TForm1.WebEdit1KeyPress(Sender: TObject; var AChar: char);
begin
// only accept validated chars. Else, return #0 to void this keypress
if (not validateInputType('jdFloat', Achar)) then Achar := #0;
end;

This is a pretty fundamental component for most WebCore developers. It is obviously something that has been changed, which I'd have thought unusual for a component that has been in production for so long. I'm basically on hold until this is fixed.

If it helps, it seems to work ok in version 2.0.0.0

Problem was traced & fixed. We'll release an update asap.

1 Like

Version 2.0.2.2 Fixes this. Thanks.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.