[Gambas-user] One report for each query?
Gianluigi
bagonergi at gmail.com
Sat Nov 2 16:17:11 CET 2019
Hi Fabien,
I would never have understood why I was convinced of using a ReportLabel.
Thank you very much and I apologize for disturbing
Gianluigi
Il giorno sab 2 nov 2019 alle ore 15:05 Fabien Bodard <gambas.fr at gmail.com>
ha scritto:
> Dim s, sHistory As String
> Dim ss As String[]
> Dim hRel As ReportTextLabel
> Dim hTitle As ReportLabel
> Dim iWidth, H, i As Integer
> Dim hResult As Result
>
> 'Report.Debug = True
> hResult = FMain.hResult
> hResult.MoveFirst
> For i = 0 To hResult.Count - 1
> sHistory &= hResult!hinum & " " & Format(hResult!hidat, gb.ShortDate)
> & "\n"
> sHistory &= hResult!hilon & "\n\n"
> hResult.MoveNext
> Next
> Report1.Font = Font["Serif,12"]
> iWidth = ReturnWidth()
> H = Report1.Font.H
> '--- Title
> hTitle = New ReportLabel(ReportVBox1)
> hTitle.Font = Font["Serif, bold, 16"]
> hTitle.Brush = ReportBrush.Color(Color.Red) '' I don't understand how do
> this sigh!
> hTitle.Alignment = Align.Center
> hTitle.Text = "History of Meismann test on " & Format(Now, gb.ShortDate)
> '---space
> hRel = New ReportTextLabel(ReportVBox1)
> hRel.Height = "10mm"
> ss = Split(sHistory, "\n", Null, False, True)
> For Each s In ss
> hRel = New ReportTextLabel(ReportVBox1)
> hRel.Font = Font["Serif,12"]
> hRel.Alignment = Align.Justify
> hRel.Text = s
> hRel.Height = CStr(Rows(s, iWidth) * H) & "px"
> Next
>
>
> The problem come fro the fact that you use a reportTextLabel... the color
> for this kind of object must be set by the richtext elements.
> In your case it is better to use a textLabel for the title that use the
> brush property :-).
>
> The other way for richtextLabel is :
>
> "<font color=#00FF00>" & MyText & "</font>"
>
> ex :
> hRel = New ReportTextLabel(ReportVBox1)
> hRel.Font = Font["Serif, bold, 16"]
> hRel.Brush = ReportBrush.Color(Color.DarkBlue) '' I don't understand how
> do this sigh!
> hRel.Alignment = Align.Center
> hRel.Text = "<font color=#0000FF>History of Meismann test on " &
> Format(Now, gb.ShortDate) & "</font>"
>
> Le sam. 2 nov. 2019 à 14:35, Gianluigi <bagonergi at gmail.com> a écrit :
>
>> Hi Fabien,
>>
>> thank you very much for the answers, you are great 👍
>> Regarding "hReport = New Report1", I would have had to figure it out on
>> my own, the senile stupidity is a bad thing :-(
>>
>> Unfortunately I still don't understand how to color the strings :-((
>>
>> See attachment with suggested changes
>>
>> Regards
>> Gianluigi
>>
>> Il giorno sab 2 nov 2019 alle ore 12:54 Fabien Bodard <
>> gambas.fr at gmail.com> ha scritto:
>>
>>> 'hRel.Brush.Color = ReportBrush.Color(Color.DarkBlue) I don't understand
>>> how do this sigh!
>>>
>>> no ! :
>>> hRel.Brush = ReportBrush.Color(Color.DarkBlue) I don't understand how do
>>> this sigh!
>>>
>>> hRel.Brush receive a brush generated by ReportBrush... it work like
>>> Paint.Brush with (paint.Color/Paint.gradient/...)
>>>
>>> Le sam. 2 nov. 2019 à 12:50, Fabien Bodard <gambas.fr at gmail.com> a
>>> écrit :
>>>
>>>> well because you use only the auto generated instance .
>>>>
>>>> When you call Report1.Preview
>>>>
>>>> in background it do a thing like
>>>>
>>>> Report1 = New Report1
>>>>
>>>> So the object Report1 theoretically is not callable directly. In the
>>>> past ... in the beginning of gambas ... (well 20 years) You cannot do
>>>> Form1.Show
>>>>
>>>> You'll have to do a :
>>>> Dim hForm as new Form1 as "Form"
>>>> hForm.Show
>>>>
>>>> All of that to say .... in your case do :
>>>>
>>>> Public Sub Button1_Click()
>>>> hreport = new Report1
>>>> $hResult = MBase.ReturnDataNumber()
>>>> If Not $hResult Then
>>>> Message.Error(("Query result not available\n\nSorry but it is
>>>> impossible to continue."))
>>>> Me.Close
>>>> Return
>>>> Endif
>>>> hReport.Preview
>>>>
>>>> End
>>>>
>>>> Public Sub Button2_Click()
>>>> hReport = new Report1
>>>> $hResult = MBase.ReturnDataDate()
>>>> If Not $hResult Then
>>>> Message.Error(("Query result not available\n\nSorry but it is
>>>> impossible to continue."))
>>>> Me.Close
>>>> Return
>>>> Endif
>>>> hReport.Preview
>>>>
>>>> End
>>>>
>>>>
>>>>
>>>> Le ven. 1 nov. 2019 à 18:24, Gianluigi <bagonergi at gmail.com> a écrit :
>>>>
>>>>> Hi Fabien,
>>>>>
>>>>> inspired by a discussion on the German forum I wanted to see if I
>>>>> could make a report in that way.
>>>>> I was unable to use the same report for two slightly different queries.
>>>>> Should I use a different report for each query?
>>>>> I can't change the color of the writing with the code.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>> Regards
>>>>> Gianluigi
>>>>>
>>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>>>>> ]----
>>>>>
>>>>
>>>>
>>>> --
>>>> Fabien Bodard
>>>>
>>>
>>>
>>> --
>>> Fabien Bodard
>>>
>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>>
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>
>
>
> --
> Fabien Bodard
>
> ----[ 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/20191102/bf44a880/attachment-0001.html>
More information about the User
mailing list