Menu

#6 Add get_text lambda to Label and ObjectValue

open
nobody
None
5
2009-05-25
2009-05-25
No

I was trying to format some totals in band_summary with get_value, so they would be formatted locale-aware and grouped, with thousand separators and so.
It didn't work, becouse FIELD_ACTION_SUM uses its result, so I created a get_text option, to handle the formatting separated from the value.

Discussion

  • Ari Caldeira

    Ari Caldeira - 2009-05-25
     
  • Ari Caldeira

    Ari Caldeira - 2009-05-25

    I just realized that my previous solution didn't take into account the field_action option.

    Already corrected in patch.

     
  • Nobody/Anonymous

    Good idea, but let's discuss a little more before put it on the trunk code. I'm not sure would be a good idea have both 'get_text' and 'get_value' at once in widgets.

    And we should think on events like "BeforeCalc", "AfterCalc" and "OnGetValue" as well.

     
  • Ari Caldeira

    Ari Caldeira - 2009-05-26

    Hum, seems to me that get_value *is* the OnGetValue event already.
    I'm thinking a little Delphi here, since I was more used to FastReport; the inner value of the widget is separated from its run-time formatted value.
    But looking at the code, I think I see what you mean: text is a settable property, storing its value in the _text variable. I guess value should be treated the same way, a settable property; then we could have both type of events: get_value, set_value, get_text, set_text.
    _value would be used in all internal functions and calculations, and _text when rendering the report.
    Such a change would merge the functionalities of Label and ObjectValue.

     

Log in to post a comment.

MongoDB Logo MongoDB