[GB.REPORT]

*NEW: The Ignore property is now available. It allow to place an object anywhere
      relative to its parent container.
*BUG: The top padding/border and bottom are correctly taked into account for the autoresize computing
*BUG: Now the text is clipped




git-svn-id: svn://localhost/gambas/trunk@4047 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Fabien Bodard 2011-08-27 14:49:54 +00:00
parent 1d68e2fcde
commit 5b68aff097
8 changed files with 336 additions and 299 deletions

View file

@ -95,7 +95,7 @@ DashDotDot
C
i
5
#Paint
#Paints
C
#Report
@ -528,7 +528,7 @@ b
_Properties
C
s
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Expand,AutoResize,Tag
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag
_Family
C
s

View file

@ -1,7 +1,7 @@
Align?
Arrange?
Line?
Paint
Paints
Report
ReportBorder
ReportBrush

View file

@ -1,10 +1,10 @@
' Gambas class file
Export
Create Private
Create Private
Public Const _IsControl As Boolean = True
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Expand,AutoResize,Tag"
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag"
Public Const _Family As String = "Report"
Public _SizeInt As TSizeHint
Public _Count As Integer = 1
@ -92,7 +92,7 @@ Public Sub _New(Optional Parent As ReportContainer = Null)
If IsNull(Parent) Then
$iParentId = -1
$iReportId = $iMyId
Else
If Parent Is Report Then
hRep = Parent
@ -105,380 +105,380 @@ Public Sub _New(Optional Parent As ReportContainer = Null)
$iReportId = Parent._ReportId
Endif
Endif
End
Private Function Id_Read() As Integer
Return $iMyId
End
Private Function Parent_Read() As ReportContainer
Return ReportControl._ObjectFromId[$iParentId]
End
Private Function Left_Read() As String
Return $sLeft
End
Private Sub Left_Write(Value As String)
$sLeft = Value
End
Private Function Top_Read() As String
Return $sTop
End
Private Sub Top_Write(Value As String)
$sTop = Value
End
Private Function Width_Read() As String
Return $sWidth
End
Private Sub Width_Write(Value As String)
$sWidth = Value
End
Private Function Height_Read() As String
Return $sHeight
End
Private Sub Height_Write(Value As String)
$sHeight = Value
End
Private Function Expand_Read() As Boolean
Return $bExpand
Return $bExpand
End
Private Sub Expand_Write(Value As Boolean)
$bExpand = Value
End
Public Sub _GetSizeHints(AvailableW As Integer, AvailableH As Integer, TotalWidth As Integer, TotalHeight As Integer) As TSizeHint
Error.Raise("Something goes wrong the _GetSizeHints is not correctly implemented")
End
Public Sub _PaintBefore(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
End
Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
End
Public Sub _PaintFrame(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
Me._Paint(Page, X, Y, hControl, VirtualId)
End
Public Sub _PaintAfter(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
End
Private Function Visible_Read() As Boolean
Return $iVisible
Return $iVisible
End
Private Sub Visible_Write(Value As Boolean)
$iVisible = Value
End
Public Sub Move(X As Float, Y As Float, W As Float, H As Float)
$fLeft = X
$fTop = Y
$fWidth = W
$fHeight = H
End
Private Function Tag_Read() As Variant
Return $vTag
Return $vTag
End
Private Sub Tag_Write(Value As Variant)
$vTag = Value
End
Private Function Font_Read() As Font
Return $hFont
End
Private Sub Font_Write(Value As Font)
$hFont = Value
End
Private Function Padding_Read() As ReportPadding
Return $hPadding
End
Private Sub Padding_Write(Value As ReportPadding)
$hPadding = Value
End
Private Function _Top_Read() As Float
Return $fTop
End
Private Function _Height_Read() As Float
Return $fHeight
End
Private Function _Width_Read() As Float
Return $fWidth
End
Private Function _Left_Read() As Float
Return $fLeft
End
Private Function _Padding_Read() As Float
Return $fPadding
End
Public Function _SetChildGeometry(X As Float, Y As Float, W As Float, H As Float, ContPage As Integer)
Public Function _SetChildGeometry(X As Float, Y As Float, W As Float, H As Float, ContPage As Integer)
End
Private Function Autoresize_Read() As Boolean
Return $bAutoresize
Return $bAutoresize
End
Private Sub Autoresize_Write(Value As Boolean)
$bAutoresize = Value
End
Private Function _RelativeWidth_Read() As Boolean
Return $bRelativeWidth
End
Private Function _RelativeHeight_Read() As Boolean
Return $bRelativeHeight
End
Private Function _RelativePadding_Read() As Boolean
Return $bRelativePadding
End
''Convert recursively string values to unified values in cm
Public Sub _SetUnifiedValues()
Dim hSizeParse As TSizeParse
'Left
hSizeParse = New TSizeParse($sLeft)
$fLeft = hSizeParse.GetValue()
'Right
hSizeParse = New TSizeParse($sTop)
$fTop = hSizeParse.GetValue()
'Width
hSizeParse = New TSizeParse($sWidth, True)
$fWidth = hSizeParse.GetValue()
$bRelativeWidth = hSizeParse.IsRelative()
'Height
hSizeParse = New TSizeParse($sHeight, True)
$fHeight = hSizeParse.GetValue()
$bRelativeHeight = hSizeParse.IsRelative()
'Padding
' hSizeParse = New TSizeParse($sPadding, True)
' $fPadding = hSizeParse.GetValue()
' $bRelativePadding = hSizeParse.IsRelative()
hSizeParse = New TSizeParse($hPadding.Left, True)
$hPadding._Left = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hPadding.Right, True)
$hPadding._Right = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hPadding.Top, True)
$hPadding._Top = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hPadding.Bottom, True)
$hPadding._Bottom = hSizeParse.GetValue()
'
End
Private Function Ignore_Read() As Boolean
Return $bIgnore
End
Private Sub Ignore_Write(Value As Boolean)
$bIgnore = Value
End
Private Function Report_Read() As Report
Return ReportControl._ObjectFromId[$iReportId]
End
Private Function _ReportId_Read() As Integer
Return $iReportId
End
Private Function Fixed_Read() As Boolean
Return $bFixed
End
Private Sub Fixed_Write(Value As Boolean)
$bFixed = Value
End
Public Sub _Reset()
Me._DataIndex = 0
End
Private Function X_Read() As String
Return $sLeft
End
Private Sub X_Write(Value As String)
$sLeft = Value
End
Private Function Y_Read() As String
Return $sTop
End
Private Sub Y_Write(Value As String)
$sTop = Value
End
Private Function Brush_Read() As ReportBrush
Return $hBrush
End
Private Sub Brush_Write(Value As ReportBrush)
$hBrush = Value
End
Private Function Color_Read() As Integer
Return $iColor
End
Private Sub Color_Write(Value As Integer)
$iColor = Value
End
Public Function _GetActualBrush(X1 As Integer, Y1 As Integer, X2 As Integer, Y2 As Integer) As PaintBrush
Dim hBrush As PaintBrush
If $hBrush Then
hBrush = $hBrush._PaintBrush(X1, Y1, X2, Y2)
Else If $iColor Then
hBrush = Paint.Color($iColor)
Else
Else
Try hBrush = Me.Parent._GetActualBrush(X1, Y1, X2, Y2)
If Not hBrush Then
If Not hBrush Then
hBrush = Paint.Color(0)
Endif
Endif
Return hBrush
End
Private Sub _ReportId_Write(Value As Integer)
$iReportId = Value
End

View file

@ -20,15 +20,14 @@ Property Key As String
Property {Format} As String
Property UseField As Boolean
Private Function Text_Read() As String
Return $sText
End
Private Sub Text_Write(Value As String)
$sText = Value
'Me._Count = 2
@ -55,102 +54,102 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As
Dim bRaiseRes As Boolean
Dim $sTempText As String
Dim sText As String
hMyHints.Height = Me._Height + Me.Padding._Top + Me.Padding._Bottom
hMyHints.Height = Me._Height + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom
If Not IsNull(Me.Font) Then Paint.Font = Me.Font
'if the size choosed by the user is less than the font height, set the object to the font height
If $sKey Then
If $sKey Then
sText = Me.Parent._GetData($sKey)
Else
sText = $sText
Endif
hExt = Paint.TextExtents(sText)
' Paint.DrawText aligns according to the font height, not the text extents
fTextWidth = MTools.PixelsToUnits(hExt.Width)
fTextHeight = MTools.PixelsToUnits(Paint.Font.Height)
'Debug "'" & sText & "'";; Paint.Font.Height;; hExt.Width
If hMyHints.Height < fTextHeight Then hMyHints.Height = fTextHeight + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom
If hMyHints.Height < (fTextHeight + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom) Then hMyHints.Height = fTextHeight + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom
If Me._RelativeHeight Then hMyHints.Height = TotalHeight * Me._Height / 100
If hMyHints.Height <= 0 Then hMyHints.Height = Me.Font.Height
If Me._Width > 0 And Not Me.Autoresize Then
If Me._Width > 0 And Not Me.Autoresize Then
hMyHints.Width = Me._Width
Else
Else
hMyHints.Width = fTextWidth + Me.Padding._Left + Me.Padding._Right + Me.Border._Left + Me.Border._Right
'IF hMyHints.Width < ME._Width THEN hMyHints.Width = ME._Width
Endif
If Me._RelativeWidth Then hMyHints.Width = TotalWidth * Me._Width / 100
If hMyHints.Width > AvailableW Then hMyHints.Width = AvailableW
If Me._RelativeWidth Then hMyHints.Width = TotalWidth * Me._Width / 100
If hMyHints.Width > AvailableW Then hMyHints.Width = AvailableW
Return hMyHints
End
Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
Dim sTempText As Variant
'Dim iPadding As Integer
Dim iX, iY, iW, iH As Integer
'iPadding = MTools.UnitsToPixels(Me._Padding)
If $sKey Then
sTempText = Me.Parent._GetData($sKey)
sTempText = Me.Parent._GetData($sKey)
Else
sTempText = $sText
sTempText = $sText
Endif
If $sFormat Then
If $sFormat Then
Try sTempText = Format(sTempText, $sFormat)
Endif
If $bUseField Then
If $bUseField Then
sTempText = DecodeText(sTempText, Page)
Endif
'Draw.Foreground = Me.Foreground
iX = (x + hControl.RealLeft + MTools.UnitsToPixels(Me.Padding._Left + Me.Border._Left))
iY = (y + hControl.RealTop + MTools.UnitsToPixels(Me.Padding._Top + Me.Border._Top))
iW = (hControl.RealWidth - MTools.UnitsToPixels(Me.Padding._Left + Me.Padding._Right + Me.Border._Left + Me.Border._Right))
iH = (hControl.RealHeight - MTools.UnitsToPixels(Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom))
Paint.Brush = Me._GetActualBrush(iX, iY, iX + hControl.RealWidth, iY + hControl.RealHeight)
If Report.Debug Then
If Report.Debug Then
Paint.Brush = Paint.Color(Color.Red)
Paint.Rectangle(ix, iy, iw, ih)
Paint.Stroke
Endif
'Set the Font if it is initialized
If Not IsNull(Me.Font) Then
If Not IsNull(Me.Font) Then
Paint.Font = Me.Font
'If Paint.ResolutionY <> Desktop.Resolution Then Stop
'Paint.Font.size = Paint.Font.size * Paint.ResolutionY / Desktop.Resolution 'mTools.ReportResolution
Endif
'Draw.Clip((x + hControl.RealLeft + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, (y + hControl.RealTop + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, hControl.RealWidth * MRTools.ReportZoom, hControl.RealHeight * MRTools.ReportZoom)
'Draw.Text($sText, (x + hControl.RealLeft + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, (y + hControl.RealTop + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, hControl.RealWidth * MRTools.ReportZoom, hControl.RealHeight * MRTools.ReportZoom, $iAlignment)
'Draw.Text($sText, (x + hControl.RealLeft + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, (y + hControl.RealTop + MRTools.UnitsToPixels(Me.Padding)) * MRTools.ReportZoom, hControl.RealWidth * MRTools.ReportZoom, hControl.RealHeight * MRTools.ReportZoom, $iAlignment)
Paint.Text(sTempText, iX, iY, iW, iH, $iAlignment)
Paint.Fill
'If $sKey Then $sText = Null
Paint.Rectangle(iX, iY, iW, iH)
Paint.Clip
Paint.Text(sTempText, iX, iY, iW, iH, $iAlignment)
Paint.Fill
Paint.ResetClip
'If $sKey Then $sText = Null
'Draw.Clip.Enabled = False
End
End
Private Function IsSpecial_Read() As Boolean
@ -158,14 +157,12 @@ Private Function IsSpecial_Read() As Boolean
End
Private Sub IsSpecial_Write(Value As Boolean)
$bIsSpecial = Value
End
Private Function Key_Read() As String
Return $sKey
@ -191,17 +188,17 @@ Private Sub Format_Write(Value As String)
End
Private Function DecodeText(sText As String, Optional Page As Integer, Optional ForSize As Boolean = False) As String
If ForSize Then
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
Private Function UseField_Read() As Boolean

View file

@ -1,37 +1,36 @@
' Gambas class file
Export
Export
Inherits ReportContainer
Public Const _Properties As String = "*"
Public Const _Similar As String = "ReportVBox"
Public Sub _new()
Super._Arrangement = Arrange.Vertical
End
Public Sub _Free()
Super._Free
End
Public Function _SetChildGeometry(X As Float, Y As Float, W As Float, H As Float, ContPage As Integer)
Public Function _SetChildGeometry(X As Float, Y As Float, W As Float, H As Float, ContPage As Integer)
Dim hChildHints As TSizeHint
Dim hChild As ReportControl
'Dim aPageItems As New CPageInfo
Dim iNExp As Integer ' Nombre d'objet a taille étendue
Dim fSExp As Float 'Place consommée par les objet a taille fixe
Dim fSpc As Float
'Dim fPdg As Float
Dim bFirst As Boolean
Dim bFirst As Boolean
Dim bExitLoop As Boolean
Dim i As Integer
Dim aPageItems As New TControl[]
Dim hTItem As TControl
Dim fFixedSpc As Float
@ -39,142 +38,163 @@ Public Function _SetChildGeometry(X As Float, Y As Float, W As Float, H As Float
Dim fHeight As Float
Dim oChild As Object
Dim j As Integer
'Dim aIgnored As New TControl[]
' If ContPage = 1 Then Stop
'Dim aIgnored As New TControl[]
' If ContPage = 1 Then Stop
'If Me.Tag = "*" Then Stop
If H = 0 Then
If H = 0 Then
Me._CurItem = Me.Children.Max
Return
Endif
fSpc = IIf(Me._RelativeSpacing, H * Me._Spacing / 100, Me._Spacing) 'ME._Spacing
'fPdg = Me._Padding
X = Me.Padding._Left
Y = Me.Padding._Top
W = W - Me.Padding._Left - Me.Padding._Right
H = H - Me.Padding._Top - Me.Padding._Bottom
Y -= fspc
'Premier scan de tout les enfants pour définir les enfants
'qui seront présent a chaque aparition du conteneur
'c'est a dire ceux avec la propriété fixed !
'Bien sur sur ce tour on ne ajoute a la page que ceux qui arrive avant la position du dernier élément parcouru
'_curitem. On profite de ce tour pour calculer la taille fixe nécéssaire a tout les élément fixes
For i = 0 To Me.Children.Max
hChild = Super.Children[i]
'For j = 0 To hChild._Count - 1
If hChild.Fixed Then
'On ne retient bien sur pas la taille d'un élément ignoré
If hChild.Fixed And If Not hChild.Ignore Then
hChildHints = hChild._GetSizeHints(W, H - fSExp, W, H)
fFixedSpc += hChildHints.Height + fspc
If i < Me._CurItem Then
hTItem = New TControl
hTItem.Ctrl = hChild
hTItem.SizeHint = hChildHints
'hTItem._SetGeometry(X, Y, W, hChildHints.Height)
'hChild._SetChildGeometry(X, Y, W, hChildHints.Height, ContPage)
aPageItems.Add(hTItem)
aPageItems.Add(hTItem)
Y += hChildHints.Height + fSpc
fFixedSpc -= hChildHints.Height + fspc
If hChild.Expand Then Inc iNExp
Endif
Endif
'Next
Next
'deuxième scan des enfant mais la on commence a l'index courant
'ici on parcour les enfants et les objet virtuellement créé par les tables ou requête fournie au conteneur.
'on va ajouter pour chacun d'eux
For i = Me._CurItem To Me.Children.Max
hChild = Super.Children[i]
For j = hChild._DataIndex To hChild._Count - 1
'Obtenir la taille verticale de l'enfant en déduisant l'espace consommé
hChildHints = hChild._GetSizeHints(W, H - fFixedSpc - Y, W, H)
' If hChild.Tag = "*" Then Stop
If Y + hChildHints.Height > H - fFixedSpc Then
hChild._DataIndex = j
bExitLoop = True
Break
Endif
hTItem = New TControl
hTItem.Ctrl = hChild
hTItem.SizeHint = hChildHints
hTItem.Index = j
'hTItem._SetGeometry(X, Y, W, hChildHints.Height)
'hChild._SetChildGeometry(X, Y, W, hChildHints.Height, ContPage)
aPageItems.Add(hTItem)
Y += hChildHints.Height + fSpc
If hChild.Fixed Then fFixedSpc -= hChildHints.Height + fspc
If hChild.Expand Then Inc iNExp
If Not hChild.Ignore Then
'Obtenir la taille verticale de l'enfant en déduisant l'espace consommé
hChildHints = hChild._GetSizeHints(W, H - fFixedSpc - Y, W, H)
If Y + hChildHints.Height > H - fFixedSpc Then
hChild._DataIndex = j
bExitLoop = True
Break
Endif
Else
'Bon bien comme c'est un objet flottant il a toute la taille qu'il veut au final
hChildHints = hChild._GetSizeHints(21, 30, 21, 30)
Endif
hTItem = New TControl
hTItem.Ctrl = hChild
hTItem.SizeHint = hChildHints
hTItem.Index = j
'hTItem._SetGeometry(X, Y, W, hChildHints.Height)
'hChild._SetChildGeometry(X, Y, W, hChildHints.Height, ContPage)
aPageItems.Add(hTItem)
Y += hChildHints.Height + fSpc
If hChild.Fixed Then fFixedSpc -= hChildHints.Height + fspc
If hChild.Expand Then Inc iNExp
Next
If bExitLoop Then
If bExitLoop Then
'Me.Report._LayoutLoop = True
Break
Endif
Inc Me._CurItem
Next
'Troisième passage pour ajouté les éléments fixes de la fin.
For i = Me._CurItem To Me.Children.Max
hChild = Super.Children[i]
If hChild.Fixed Then
If hChild.Fixed And If Not hChild.Ignore Then
hChildHints = hChild._GetSizeHints(W, H - fFixedSpc, W, H)
hTItem = New TControl
hTItem.Ctrl = hChild
hTItem.SizeHint = hChildHints
'hTItem._SetGeometry(X, Y, W, hChildHints.Height)
'hChild._SetChildGeometry(X, Y, W, hChildHints.Height, ContPage)
aPageItems.Add(hTItem)
aPageItems.Add(hTItem)
Y += hChildHints.Height + fSpc
If hChild.Expand Then Inc iNExp
Endif
Next
If iNExp > 0 Then fSExp = (H - Y) / iNExp
'Calcul de l'espace llibre pur les élément expended
If iNExp > 0 Then fSExp = (H - Y) / iNExp
'Position Reel du point haut
Y = Me.Padding._Top
'If Me.Tag = "*" Then Stop
'
'Bon allez on parcour la page virtuelle cr éée pour mettre en forme les éléments(expand) et le spacing,
'Padding lui est règlé par setchlidgeometry
'Puis on parcour aussi les enfant de l'élément si c'est un conteneur
For Each hTItem In aPageItems
oChild = hTItem.Ctrl
If hTItem.Ctrl.Expand Then
fHeight = hTItem.SizeHint.Height + fSExp
If Not oChild.Ignore Then
If hTItem.Ctrl.Expand Then
fHeight = hTItem.SizeHint.Height + fSExp
Else
fHeight = hTItem.SizeHint.Height
Endif
hTItem._SetGeometry(X, Y, W, fHeight)
oChild._SetChildGeometry(X, Y, W, fHeight, ContPage)
Else
fHeight = hTItem.SizeHint.Height
hTItem._SetGeometry(Me.Padding._Left + oChild._Left, Me.Padding._Top + oChild._Top, hTItem.SizeHint.Width, hTItem.SizeHint.Height)
oChild._SetChildGeometry(Me.Padding._Left + oChild._Left, Me.Padding._Top + oChild._Top, hTItem.SizeHint.Width, hTItem.SizeHint.Height, ContPage)
Endif
hTItem._SetGeometry(X, Y, W, fHeight)
oChild._SetChildGeometry(X, Y, W, fHeight, ContPage)
If oChild Is ReportContainer Then
If oChild._CurItem < oChild.Children.count Then
j = Me.Children.Find(oChild)
Me._CurItem = Min(j, Me._CurItem)
Endif
Endif
Y += fHeight + fspc
Next
'Oui si l'élément est fixe il n'est pas parcourable !
If Me.Fixed Then Me._CurItem = 0
'On ajoute le tableau d'élément contenu dans la page au tableau de Pages du controle et a l'index de la dite page
Me._PageChildren[ContPage] = aPageItems
'If bExitLoop Then Return True
End
Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As Float, TotalHeight As Float) As TSizeHint
Dim hChild As ReportControl
Dim fHeight As Float
Dim hChildHints As TSizeHint
@ -184,51 +204,50 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As
Dim i, j As Integer
'If Me._SizeInt Then Return Me._SizeInt
fSpacing = IIf(Me._RelativeSpacing, TotalHeight * Me._Spacing / 100, Me._Spacing)
For i = Me._CurItem To Me.Children.max
hChild = Me.Children[i]
For j = hChild._DataIndex To hChild._Count - 1
hChildHints = hChild._GetSizeHints(AvailableW, AvailableH - hMyHints.Height, AvailableW, AvailableH)
hMyHints.Height += hChildHints.Height + fSpacing 'ME._Spacing
If fHeight = 0 Then fHeight = hChildHints.Height
If hMyHints.Width < hChildHints.Width Then hMyHints.Width = hChildHints.Width
If hMyHints.Height > AvailableH Then
i = Me.Children.Max
Break
Endif
hChildHints = hChild._GetSizeHints(AvailableW, AvailableH - hMyHints.Height, AvailableW, AvailableH)
hMyHints.Height += hChildHints.Height + fSpacing 'ME._Spacing
If fHeight = 0 Then fHeight = hChildHints.Height
If hMyHints.Width < hChildHints.Width Then hMyHints.Width = hChildHints.Width
If hMyHints.Height > AvailableH Then
i = Me.Children.Max
Break
Endif
Next
Next
hMyHints.Height -= fSpacing
Next
hMyHints.Height -= fSpacing
hMyHints.Height += Me.Padding._Top + Me.Padding._Bottom '+ 2 * Me._BorderWidth
fHeight += Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom
If Me._Height > fHeight Then fHeight += Me._Height
If Me._Height > fHeight Then fHeight += Me._Height
If hMyHints.Height < fHeight And Not Me.Autoresize Then hMyHints.Height = fHeight
If Me._RelativeHeight Then hMyHints.Height = AvailableH * Me._Height / 100
If hMyHints.Height > AvailableH Then
If hMyHints.Height > AvailableH Then
If Me.Expand Then
hMyHints.Height = AvailableH
Else
Else
hMyHints.Height = fHeight
Endif
Endif
If Not Me.Autoresize Then
If Not Me.Autoresize Then
If Me._RelativeWidth Then hMyHints.Width = AvailableW * Me._Width / 100
hMyHints.Width = Me._Width
hMyHints.Width = Me._Width
Endif
Me._SizeInt = hMyHints
Return hMyHints
End

View file

@ -1,18 +1,19 @@
' Gambas class file
Public Sub _new()
Dim Rlbl As ReportLabel
Dim i As Integer
'Report.Debug = True
For i = 0 To 1000
Rlbl = New ReportLabel(RVBCont)
Rlbl.Text = "Ligne " & i
Rlbl.Border.bottom.Width = "1px"
Next
End
Rlbl.Padding.Top = "3 mm"
Rlbl.Padding.Bottom = "1mm"
Rlbl.Padding.Left = "2 mm"
Next
End

View file

@ -18,12 +18,15 @@
}
{ ReportLabel3 ReportLabel
#MoveScaled(20,2,48,10)
Left = "1mm"
Top = "1mm"
Width = "3cm"
Brush = ReportBrush["LinearGradient(0.98,0.04,0.04,0.04,[#FFFF00,#FFFFFF],[0,1])"]
Fixed = True
Font = Font["DejaVu Sans,Bold,+14"]
Padding = ReportPadding["Top:6mm;Bottom:6mm;Left:6mm;Right:6mm"]
Ignore = True
Expand = True
AutoResize = True
Text = ("Gambas")
Alignment = Align.Left
}
@ -48,7 +51,23 @@
Tag = "*"
{ ReportLabel1 ReportLabel
#MoveScaled(4,3,44,9)
Font = Font["+3"]
Padding = ReportPadding["Top:4mm;Bottom:4mm;Left:2mm"]
Text = ("Gambas Report Demo")
Alignment = Align.Center
}
{ ReportLabel4 ReportLabel
#MoveScaled(4,10,48,10)
Left = "1mm"
Top = "5cm"
Brush = ReportBrush["LinearGradient(0.98,0.04,0.04,0.04,[#FFFF00,#FFFFFF],[0,1])"]
Fixed = True
Font = Font["DejaVu Sans,Bold,+14"]
Padding = ReportPadding["Top:6mm;Bottom:6mm;Left:6mm;Right:6mm"]
Ignore = True
AutoResize = True
Text = ("Gambas")
Alignment = Align.Left
}
}
{ ReportLabel2 ReportLabel
@ -57,6 +76,7 @@
Fixed = True
Font = Font["Bold,+1"]
Padding = ReportPadding["Top:4mm;Bottom:4mm;Left:2mm;Right:2mm"]
AutoResize = True
Border = ReportBorder["Top:1mm #000000"]
Background = ReportBrush["#3398C3"]
Text = ("Page $PAGE on $NPAGE")