Vi riporto queta discussione apparsa sulla M.L. ufficiale:
" Hello,
I'm blundering through my first report. I've looked at the examples and
tried the same code as in report1. Had to make some modifications to
connect to MySQL Database. The report contains a ReportVBox called
RVBCont and a ReportLabel called ReportLabel1.
The code is below:
Public Sub _new(sType As String)
Dim $Query As String
Dim Rlbl As ReportLabel
Dim strTest As String
$Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
hResult1 = modMain.$Con.Exec($Query)
hResult1.MoveFirst
'Report.Debug = True
'ReportPanel1.DataCount = hResult1.Count
strTest = CStr(hResult1.Count)
For Each hResult1
Rlbl = New ReportLabel(RVBCont)
Rlbl.Autoresize = True
Rlbl.Text = hResult1!Last_Name & " " & hResult1!First_Name
strTest = Rlbl.Text
Rlbl.Border.bottom.Width = "1px"
Next
End
The report appears to run. Looking a strTest shows that the names are in
the Rlbl.Text property. Nothing prints on the report preview. It is
blank. In the debug widow is the message "gnome keyring couldn't connect
to /tmp/key-ring-nWROjb/pkcs11 - No such directory".
I'm using Gambas 3.5 on Ubutu 12.04 LTS.
By the way I did look a Fabien's sight but I do not speak French. Maybe
some one could suggest a good reference in English.
Thanks,
Marty "
" try to put autoresize to true on the ReportVBox
(it's defult size is 0) or it's expand property to true
This is a thing i want to change on the reportcontrol definition ...
they must have at less 1 cm of hight/width... but it's not so simple
when many report known the default to be at 0
Another thing
Add a reportHbox in the reportVBox in the report editor. Set its height as 1 cm
add in it a reportLabel name it lblField and delete the text property content.
then in the code
Public Sub _new(sType As String)
Dim $Query As String
Dim Rlbl As ReportLabel
Dim strTest As String
$Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
hResult1 = modMain.$Con.Exec($Query)
ReportHBox1.DataCount = hResult1.Count
end
Public sub lblField_Data(Index as integer)
hResult1.MoveTo(Index)
Last.Data = hResult1!Last_Name & " " & hResult1!First_Name
end
Fabien "
" Fabien,
Thanks for your reply. I tried your first suggestion. Changed autoresize
and expand to true on the reportvbox. Still nothing prints.
Tried your second suggestion. Added reporthbox in reportvbox. Added
lblField to reporthbox with empty text content. Add lblField_Data(Index
as Integer) sub also.
No results. In debug the main routine ends and the data sub does not
execute. The reporthbox.DataContent = 10.
New code:
Public Sub _new(sType As String)
Dim $Query As String
Dim strTest As String
$Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
hResult1 = modMain.$Con.Exec($Query)
'Report.Debug = True
ReportHBox1.DataCount = hResult1.Count
strTest = CStr(ReportHBox1.DataCount)
End
Public Sub lblField_Data(Index As Integer)
hResult1.MoveTo(Index)
Last.Data = hResult1!Last_Name & " " & hResult1!First_Name
End
The height of the reporthbox is set to 1 cm.
Other suggestions?
Thanks,
Marty "
" Did a little more debugging and found that the lblField data event does
cycle through the ten records. I can see each one in the console local
variables. So it must have to due with the different boxes on the
report. Something prevents the displa of the data.
Marty "