Jump to content

FormatFloat OnExit TUniDbNumberEdit


zanona

Recommended Posts

In VCL the command below works perfectly returning +5.00

 

procedure TForm4.DBEdit1Exit (Sender: TObject);

begin

   DBEdit1.Text: = FormatFloat ('+ 0.00; -0.00', 5);

   ShowMessage (DBEdit1.Text);

end;

 

If I try the same on Unigui it always returns the value of 5! would this be some kind of bug? I looked at the source code and realized it has a validation below!

 

procedure TUniBaseEdit.SetText (AValue: TCaption);

begin

   if IsNumberEdit then

   begin

     AValue: = Trim (AValue);

 

     CheckBlank (AValue);

 

     if FIsBlankValue then

     begin

       FChanged: = True;

       if FValue <> -1 then

       begin

         FValue: = -1;

         DoOnChangeValue;

       end;

       SetVCLProperty ('Text', '');

     end

     else

       Self.Value: = StrToFloat (AValue, FmtSettings);

   end

   else

   begin

     AValue: = AdjustCase (AValue);

     if AValue <> InternalText then

     begin

       inherited SetText (AValue);

       FChanged: = True;

     end;

   end;

end;

 

Can not he respect what happens in the VCL?

 

 

Thanks

 

Zanona

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...