[Gambas-user] Questions about gb.report2

Gianluigi bagonergi at gmail.com
Tue Aug 20 17:12:34 CEST 2019


Hi Hans,

You have the answer to the first two questions in the IDE by navigating in
the Gambas project (in my case, gambasdevel) until you open in the
Components gb.report2 > ReportControl > ReportFrame > ReportLabel.
In ReportLabel.class you can see this code in the _Paint routine:

  If sTempText Begins "=" Then
     $hEval.Compile()
     sTempText = $hEval.Value
  Endif

  If $sFormat Then
    Try sTempText = Format(sTempText, $sFormat)
  Endif

  If $bUseField Then
    sTempText = DecodeText(sTempText, Page)
  Endif

and the Function:

Private Function DecodeText(sText As String, Optional Page As Integer,
Optional ForSize As Boolean = False) As String

  If ForSize Then
    If InStr(sText, "$PAGE") Then sText = Replace(sText, "$PAGE", "999")
    If InStr(sText, "$NPAGE") Then sText = Replace(sText, "$NPAGE", "999")
  Else
    If InStr(sText, "$PAGE") Then sText = Replace(sText, "$PAGE", Str(Page
+ 1))
    If InStr(sText, "$NPAGE") Then sText = Replace(sText, "$NPAGE",
Str(Me.Report.PageCount))
  Endif

  Return sText

End

If I well understood Fabien's intentions, now it only works with page,
pages, index but I think the intention is to extend it to other regular
expressions.
But I'm not sure.

UserField: Fabien in tmpJournal write this:
Restore the UseField property in ReportLabel so for now the component is
backward compatible.

Range: I don't think it's activated in either gb.report2, see:

http://gambaswiki.org/wiki/comp/gb.report/reportcontrol/range

Regards
Gianluigi

Il giorno mar 20 ago 2019 alle ore 11:08 Hans Lehmann <hans at gambas-buch.de>
ha scritto:

> Hello,
>
> I currently have several questions about the component gb.report2:
>
>
>    - Where can I find information about the variables(?) `page` and
>    `pages? So far I couldn't find anything on the internet.
>    - Why do I have to write ReportLabel in the properties (in the IDE in
>    the object inspector) to a report control ReportLabel as footer in the
>    properties for example `="Page " & page & " of " & pages`? Why the equal
>    sign at the beginning?
>    - What is the meaning of the `UseField` property? Which field is meant
>    by this?
>    - We are looking for documentation for the property `Range`. What do I
>    have to add to the `Range` property? Which data type? Which value range is
>    to be considered?
>
>
> With kind regards
>
> Hans
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190820/49ed8cba/attachment.html>


More information about the User mailing list