[GB.DB.FORM]
* NEW: DataComboView: Draw current selected record with the same layout as the popup DataView uses. git-svn-id: svn://localhost/gambas/trunk@7193 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
bc0a813092
commit
b4c575b6ed
@ -31,7 +31,6 @@ Event Validate
|
|||||||
'Property Font As Font
|
'Property Font As Font
|
||||||
|
|
||||||
Private $hDrawingArea As DrawingArea
|
Private $hDrawingArea As DrawingArea
|
||||||
Private $sText As String
|
|
||||||
Private $hPopup As Window
|
Private $hPopup As Window
|
||||||
Private $hSrc As DataSource
|
Private $hSrc As DataSource
|
||||||
Private $hView As DataView
|
Private $hView As DataView
|
||||||
@ -47,6 +46,9 @@ Private $bInside As Boolean
|
|||||||
Private $bInsideArrow As Boolean
|
Private $bInsideArrow As Boolean
|
||||||
Private $bPressed As Boolean
|
Private $bPressed As Boolean
|
||||||
|
|
||||||
|
Private $aText As String[]
|
||||||
|
Private $aWidth As Integer[]
|
||||||
|
Private $aAlign As Integer[]
|
||||||
|
|
||||||
Public Sub _new()
|
Public Sub _new()
|
||||||
|
|
||||||
@ -290,13 +292,15 @@ End
|
|||||||
Private Sub SetValue(vVal As Variant)
|
Private Sub SetValue(vVal As Variant)
|
||||||
|
|
||||||
Dim sText As String
|
Dim sText As String
|
||||||
Dim iInd As Integer
|
Dim I As Integer
|
||||||
Dim hView As TableView
|
Dim hView As TableView
|
||||||
|
|
||||||
LoadPopup
|
LoadPopup
|
||||||
If IsNull(vVal) Then
|
If IsNull(vVal) Then
|
||||||
'$hView.Create()
|
'$hView.Create()
|
||||||
$sText = ""
|
$aText = Null
|
||||||
|
$aWidth = Null
|
||||||
|
$aAlign = Null
|
||||||
$hDrawingArea.Refresh
|
$hDrawingArea.Refresh
|
||||||
Return
|
Return
|
||||||
Endif
|
Endif
|
||||||
@ -306,11 +310,16 @@ Private Sub SetValue(vVal As Variant)
|
|||||||
|
|
||||||
hView = $hView.View
|
hView = $hView.View
|
||||||
|
|
||||||
For iInd = 0 To hView.Columns.Count - 1
|
$aText = New String[hView.Columns.Count]
|
||||||
sText &= " | " & hView[hView.Row, iInd].Text
|
$aWidth = New Integer[$aText.Count]
|
||||||
|
$aAlign = New Integer[$aText.Count]
|
||||||
|
|
||||||
|
For I = 0 To $aText.Max
|
||||||
|
$aText[I] = hView[hView.Row, I].Text
|
||||||
|
$aWidth[I] = hView.Columns[I].Width
|
||||||
|
$aAlign[I] = hView[hView.Row, I].Alignment
|
||||||
Next
|
Next
|
||||||
|
|
||||||
$sText = Mid$(sText, 4)
|
|
||||||
$hDrawingArea.Refresh
|
$hDrawingArea.Refresh
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -374,8 +383,8 @@ Private Sub OpenPopup()
|
|||||||
|
|
||||||
$hView.Current = [$vCurrent]
|
$hView.Current = [$vCurrent]
|
||||||
|
|
||||||
$hPopup.Resize(Me.Width, Min(8, $hView.Count) * (1 + $hView.View.Rows.Height) + $hView.View.Columns.H + 2)
|
$hPopup.Resize(Me.Width - Desktop.Scale, Min(8, $hView.Count) * (1 + $hView.View.Rows.Height) + $hView.View.Columns.H + 2)
|
||||||
$hPopup.ShowPopup(Me.ScreenX, Me.ScreenY + Me.Height)
|
$hPopup.ShowPopup(Me.ScreenX + Desktop.Scale, Me.ScreenY + Me.Height)
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
@ -428,6 +437,8 @@ Public Sub DrawingArea_Draw()
|
|||||||
Dim iFlag As Integer
|
Dim iFlag As Integer
|
||||||
Dim sText As String
|
Dim sText As String
|
||||||
Dim bFlat As Boolean
|
Dim bFlat As Boolean
|
||||||
|
Dim I As Integer
|
||||||
|
Dim X2 As Integer
|
||||||
|
|
||||||
If $bInside And If Me.Enabled Then iFlag += Draw.Hover
|
If $bInside And If Me.Enabled Then iFlag += Draw.Hover
|
||||||
If Not Me.Enabled Then iFlag += Draw.Disabled
|
If Not Me.Enabled Then iFlag += Draw.Disabled
|
||||||
@ -435,49 +446,22 @@ Public Sub DrawingArea_Draw()
|
|||||||
|
|
||||||
'' TODO: System.RightToLeft
|
'' TODO: System.RightToLeft
|
||||||
|
|
||||||
'bFlat = Not $bBorder 'And Not $bInside
|
Style.PaintButton(0, 0, Me.W, Me.H, $bPressed, iFlag, bFlat)
|
||||||
|
Style.PaintArrow(Me.W - Desktop.Scale * 2, 0, Desktop.Scale, Me.H, Align.Bottom, iFlag)
|
||||||
'If $bInsideArrow Then
|
|
||||||
' Draw.Style.Button(0, 0, Me.W, Me.H, False, iFlag, bFlat)
|
|
||||||
' 'Draw.Save
|
|
||||||
' 'Draw.Clip(Me.W - Desktop.Scale * 3 + 3, 0, Desktop.Scale * 3 - 3, Me.H)
|
|
||||||
' 'Draw.Style.Button(0, 0, Me.W, Me.H, $bPressed, iFlag, Not $bBorder)
|
|
||||||
' 'Draw.Restore
|
|
||||||
'Else
|
|
||||||
Draw.Style.Button(0, 0, Me.W, Me.H, $bPressed, iFlag, bFlat)
|
|
||||||
'Endif
|
|
||||||
|
|
||||||
X = Desktop.Scale
|
If $aText Then
|
||||||
|
|
||||||
|
X = Desktop.Scale
|
||||||
|
|
||||||
' If $hPicture Then
|
Paint.ClipRect = Rect(0, 0, Me.W - Desktop.Scale * 3, Me.H)
|
||||||
' If Me.Enabled Then
|
For I = 0 To $aText.Max
|
||||||
' Draw.Picture($hPicture, X, (Me.H - $hPicture.H) / 2)
|
X2 = X + $aWidth[I]
|
||||||
' Else
|
Paint.DrawText($aText[I], X + 4, 0, X2 - X - 5, Me.H, $aAlign[I])
|
||||||
' Draw.Picture($hPicture.Image.Desaturate().Picture, X, (Me.H - $hPicture.H) / 2)
|
X = X2
|
||||||
' Endif
|
Next
|
||||||
' X += $hPicture.H + Desktop.Scale
|
|
||||||
' Endif
|
|
||||||
|
|
||||||
If $sText Then
|
|
||||||
sText = $sText
|
|
||||||
'If $iShortcutPos Then sText = String.Left($sText, $iShortcutPos - 1) & String.Mid$($sText, $iShortcutPos + 1)
|
|
||||||
'If Not $hPicture And If Not $bArrow Then
|
|
||||||
' X = (Me.W - Draw.Font.TextWidth(sText)) \ 2
|
|
||||||
'Endif
|
|
||||||
Draw.Text(sText, X, 0, Me.W - X, Me.H, Align.Left)
|
|
||||||
'If $iShortcutPos Then
|
|
||||||
' X2 = X + Draw.Font.TextWidth(String.Left(sText, $iShortcutPos))
|
|
||||||
' X += Draw.Font.TextWidth(String.Left(sText, $iShortcutPos - 1))
|
|
||||||
' Y = (Me.H - Draw.Font.Height) / 2 + Draw.Font.Ascent + 1
|
|
||||||
' Draw.Line(X, Y, X2, Y)
|
|
||||||
'Endif
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
'If $bArrow Then
|
|
||||||
'If $bBorder Or If $bInside Then Draw.Style.Separator(Me.W - Desktop.Scale * 3, 3, 3, Me.H - 6, True)
|
|
||||||
Draw.Style.Arrow(Me.W - Desktop.Scale * 2, 0, Desktop.Scale, Me.H, Align.Bottom, iFlag)
|
|
||||||
'Endif
|
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub DrawingArea_KeyPress()
|
Public Sub DrawingArea_KeyPress()
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
}
|
}
|
||||||
{ DataComboView1 DataComboView
|
{ DataComboView1 DataComboView
|
||||||
MoveScaled(2,30,50,4)
|
MoveScaled(2,30,50,4)
|
||||||
Table = "color"
|
Table = "test"
|
||||||
Columns = ["color", "name"]
|
Columns = Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user