Jump to content


Photo

NextGrid.Footer.FormatMask does not work correctly


  • Please log in to reply
28 replies to this topic

#21 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 22 November 2007 - 03:51 PM

Hello Sayxanath,

I will need to think about all once more. I will be back here soon.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#22 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 23 November 2007 - 01:48 AM

Hello Sayxanath,

Can you please tell me does it will be good next solution:

- New property Footer.FormulaMask
- When CalculateFooter is called, formula is calculated and result is processed with Footer.FormulaMask . Please note that value will be transfered here into string.
- Final result may be displayed with using rules from Footer.FormatMask property

FormatFloat mask unfortunatelly can't be used because it will cause AV on non-numeric Footer.Caption .

I don't see any other solution here sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#23 Vu Quang Thang

Vu Quang Thang
  • Members
  • 91 posts

Posted 23 November 2007 - 05:17 AM

Hello Boki,

Why don't you process masking before converting into string? Do so will not make AV error.

Why MaskKind is not a good solution?

Kind regards

#24 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 23 November 2007 - 08:39 AM

Hello Sayxanath,

I will try then with MaskKind (mlText, mkFloat). By default mkText mask will be used, but you will be able to swith this property.

I will add it today.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#25 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 23 November 2007 - 05:50 PM

Hello Sayxanath,

Please do next.

1) Open NxColumns.pas file
2) Add new type:

CODE
  TFormatMaskKind = (mkText, mkFloat);


3) Add new property for TColumnFooter:

CODE
private
    FFormatMaskKind: TFormatMaskKind;
...
    procedure SetFormatMaskKind(const Value: TFormatMaskKind);
...
published
...
    property FormatMaskKind: TFormatMaskKind read FFormatMaskKind write SetFormatMaskKind default mkText;
...
implementation
...
procedure TColumnFooter.SetFormatMaskKind(const Value: TFormatMaskKind);
begin
  FFormatMaskKind := Value;
  DoChange(Self);
end;


4) Inside NxDisplays.pas locate procedure TStyleDisplay.DrawFooterContent:

Replace block of code which begin with if FormatMask <> ... at beginning of procedure with:

CODE
    if FormatMask <> '' then
    begin
      case Column.Footer.FormatMaskKind of
        mkText: FormatedText := FormatMaskText(FormatMask, Caption);
        mkFloat: FormatedText := FormatFloat(FormatMask, StrToFloat(Caption));
      end;
    end else FormatedText := Caption;


Now recompile packages and set FormatMaskKind to mkFloat. Please note that this kind of mask will work ONLY for numbers (as may be seen from this code StrToFloat).

I hope that this work fine now.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#26 Vu Quang Thang

Vu Quang Thang
  • Members
  • 91 posts

Posted 03 December 2007 - 06:59 AM

Hello Boki,

The footer format mask works fine now. But if we specify the footer right alignment (and format mask is something like #,##0), it is too close to the right margin.

Kind regards,

#27 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 03 December 2007 - 08:34 AM

Hello Sayxanath,

I think that correct value is #,##0.00

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#28 Vu Quang Thang

Vu Quang Thang
  • Members
  • 91 posts

Posted 03 December 2007 - 10:08 AM

Hello Boki,

No matter what format mask is, the footer value is too close to the margin if is is right aligned.

Kind regards,

#29 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 03 December 2007 - 05:42 PM

Hello Sayxanath,

Yes, you are correct (I was mix to far and to close). I will move it for 2px most probably.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users