[GB.DB.FORM]
* NEW: DataControl can handle blob fields now. * NEW: Highlight the byte under the mouse in blob editor. [GB.FORM] * NEW: ButtonBox.Pos is a new property that returns the cursor position of its inner TextBox. git-svn-id: svn://localhost/gambas/trunk@5741 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
1d2cbc60da
commit
b814f368c5
16 changed files with 368 additions and 196 deletions
|
@ -1,6 +1,6 @@
|
|||
[Component]
|
||||
Key=gb.db.form
|
||||
Version=3.4.0
|
||||
Version=3.4.90
|
||||
Authors=Benoît Minisini
|
||||
Needs=Form
|
||||
Requires=gb.db,gb.form
|
||||
|
|
|
@ -334,6 +334,14 @@ Update
|
|||
m
|
||||
|
||||
|
||||
ButtonBox_Click
|
||||
m
|
||||
|
||||
|
||||
ButtonBox_DblClick
|
||||
m
|
||||
|
||||
|
||||
#DataSource
|
||||
Panel
|
||||
C
|
||||
|
|
|
@ -14,15 +14,15 @@ msgstr ""
|
|||
msgid "Data bound controls"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:88 DataView.class:455
|
||||
#: DataControl.class:95 DataView.class:452
|
||||
msgid "True"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:89 DataField.class:19 DataView.class:455
|
||||
#: DataControl.class:96 DataField.class:19 DataView.class:452
|
||||
msgid "False"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:90
|
||||
#: DataControl.class:97
|
||||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
|
@ -34,19 +34,19 @@ msgstr ""
|
|||
msgid "You must fill all mandatory fields."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:726
|
||||
#: DataView.class:723
|
||||
msgid "Unable to save value."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:728
|
||||
#: DataView.class:725
|
||||
msgid "Incorrect value."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:890
|
||||
#: DataView.class:887
|
||||
msgid "Unable to save record."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:1054
|
||||
#: DataView.class:1051
|
||||
msgid "Unable to delete record."
|
||||
msgstr ""
|
||||
|
||||
|
@ -66,31 +66,31 @@ msgstr ""
|
|||
msgid "Clear"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:101
|
||||
#: FBlobEditor.class:122
|
||||
msgid "Save blob to file"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:110
|
||||
#: FBlobEditor.class:131
|
||||
msgid "Unable to save file"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:116
|
||||
#: FBlobEditor.class:137
|
||||
msgid "Load blob from file"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:125
|
||||
#: FBlobEditor.class:146
|
||||
msgid "Unable to load file"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:131
|
||||
#: FBlobEditor.class:152
|
||||
msgid "Do you really want to clear blob?"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:131
|
||||
#: FBlobEditor.class:152
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: FBlobEditor.class:139
|
||||
#: FBlobEditor.class:160
|
||||
msgid "Unable to clear blob"
|
||||
msgstr ""
|
||||
|
||||
|
@ -102,7 +102,7 @@ msgstr ""
|
|||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: FBrowser.form:56 FMain2.form:37 FMain3.form:20 FTest.form:29
|
||||
#: FBrowser.form:56 FMain2.form:40 FMain3.form:20 FTest.form:29
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
||||
|
@ -126,38 +126,42 @@ msgstr ""
|
|||
msgid "End"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:81
|
||||
#: FMain2.form:87
|
||||
msgid "Id"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:86
|
||||
#: FMain2.form:92
|
||||
msgid "Color"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:91
|
||||
#: FMain2.form:97
|
||||
msgid "First Name"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:96
|
||||
#: FMain2.form:102
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:101
|
||||
#: FMain2.form:107
|
||||
msgid "Birth"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:106
|
||||
#: FMain2.form:112
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:112
|
||||
#: FMain2.form:118
|
||||
msgid "Comment"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:118
|
||||
#: FMain2.form:124
|
||||
msgid "Salary"
|
||||
msgstr ""
|
||||
|
||||
#: FMain2.form:129
|
||||
msgid "Image"
|
||||
msgstr ""
|
||||
|
||||
#: FMain3.form:25
|
||||
msgid "Info"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.4.90
|
||||
Title=Data bound controls
|
||||
Startup=Main
|
||||
Startup=FMain2
|
||||
Version=3.4.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
|
|
|
@ -23,6 +23,9 @@ Private $hInfo As DataField
|
|||
Private $vVal As Variant
|
||||
Private $hSource As DataSource
|
||||
|
||||
Private $hObs As Observer
|
||||
Private $sBlob As String
|
||||
|
||||
Public Sub _new()
|
||||
|
||||
Me._AutoResize = True
|
||||
|
@ -36,6 +39,7 @@ Private Sub CreateControl()
|
|||
Dim hTextArea As TextArea
|
||||
Dim hComboBox As ComboBox
|
||||
Dim hDateBox As DateBox
|
||||
Dim hButtonBox As ButtonBox
|
||||
Dim sType As String
|
||||
Dim bFocus As Boolean
|
||||
Dim bReadOnly As Boolean
|
||||
|
@ -57,6 +61,9 @@ Private Sub CreateControl()
|
|||
Else
|
||||
sType = "TextArea"
|
||||
Endif
|
||||
|
||||
Case db.Blob
|
||||
sType = "ButtonBox"
|
||||
|
||||
End Select
|
||||
|
||||
|
@ -101,17 +108,29 @@ Private Sub CreateControl()
|
|||
hTextArea.ScrollBar = Scroll.Vertical
|
||||
'hTextArea.ReadOnly = $hInfo.ReadOnly
|
||||
Endif
|
||||
|
||||
Case db.Blob
|
||||
hButtonBox = $hCtrl
|
||||
hButtonBox.ReadOnly = True
|
||||
'hButtonBox.Border = False
|
||||
hButtonBox.Text = "Blob"
|
||||
hButtonBox.Foreground = Color.LightForeground
|
||||
|
||||
$hObs = New Observer(hButtonBox) As "ButtonBox"
|
||||
|
||||
End Select
|
||||
|
||||
bReadOnly = $hInfo.ReadOnly
|
||||
'IF $hSource.Index < 0 AND $hInfo.Key THEN bReadOnly = FALSE
|
||||
|
||||
If $hCtrl Is ComboBox Then
|
||||
$hCtrl.Enabled = Not bReadOnly
|
||||
Else
|
||||
Try $hCtrl.ReadOnly = bReadOnly
|
||||
If $hInfo.Type <> db.Blob Then
|
||||
If $hCtrl Is ComboBox Then
|
||||
$hCtrl.Enabled = Not bReadOnly
|
||||
Else
|
||||
Try $hCtrl.ReadOnly = bReadOnly
|
||||
Endif
|
||||
Endif
|
||||
|
||||
$hCtrl.Font.Bold = $hInfo.Key
|
||||
$hCtrl.Background = If(bReadOnly, Color.ButtonBackground, Color.Default)
|
||||
If bFocus Then $hCtrl.SetFocus
|
||||
|
@ -161,7 +180,12 @@ Private Function Modified_Read() As Boolean
|
|||
|
||||
Try vVal = GetValue()
|
||||
If Error Then Return
|
||||
Return vVal <> $vVal
|
||||
If TypeOf($vVal) = gb.Object And If $vVal Is Blob Then
|
||||
If Len(vVal) <> $vVal.Length Then Return True
|
||||
Return vVal <> $vVal.Data
|
||||
Else
|
||||
Return vVal <> $vVal
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
@ -210,7 +234,9 @@ Private Sub Value_Write(vVal As Variant)
|
|||
Case db.Float
|
||||
vVal = CFloat(vVal)
|
||||
|
||||
Case db.String
|
||||
Case db.Blob
|
||||
|
||||
Case Else
|
||||
vVal = CStr(vVal)
|
||||
|
||||
End Select
|
||||
|
@ -261,6 +287,13 @@ Private Sub SetValue(vVal As Variant)
|
|||
|
||||
Case db.String
|
||||
$hCtrl.Text = vVal
|
||||
|
||||
Case db.Blob
|
||||
If vVal Is Blob Then
|
||||
$sBlob = vVal.Data
|
||||
Else
|
||||
$sBlob = vVal
|
||||
Endif
|
||||
|
||||
End Select
|
||||
|
||||
|
@ -302,10 +335,13 @@ Private Function GetValue() As Variant
|
|||
' Endif
|
||||
|
||||
Case db.Boolean
|
||||
Return Choose($hCtrl.Index + 1, True , False , Null )
|
||||
Return Choose($hCtrl.Index + 1, True, False, Null)
|
||||
|
||||
Case db.String
|
||||
Return $hCtrl.Text
|
||||
|
||||
Case db.Blob
|
||||
Return $sBlob
|
||||
|
||||
End Select
|
||||
|
||||
|
@ -317,14 +353,21 @@ Public Sub SetFocus()
|
|||
|
||||
End
|
||||
|
||||
' PUBLIC SUB Control_GotFocus()
|
||||
'
|
||||
' RAISE GotFocus
|
||||
'
|
||||
' END
|
||||
'
|
||||
' PUBLIC SUB Control_LostFocus()
|
||||
'
|
||||
' RAISE LostFocus
|
||||
'
|
||||
' END
|
||||
Public Sub ButtonBox_Click()
|
||||
|
||||
If Not FBlobEditor.Run($sBlob, $sKey, Not $hInfo.ReadOnly) Then
|
||||
Inc Application.Busy
|
||||
$sBlob = FBlobEditor.Data
|
||||
FBlobEditor.Data = ""
|
||||
Dec Application.Busy
|
||||
Endif
|
||||
|
||||
Stop Event
|
||||
|
||||
End
|
||||
|
||||
Public Sub ButtonBox_DblClick()
|
||||
|
||||
ButtonBox_Click
|
||||
|
||||
End
|
||||
|
|
|
@ -392,7 +392,7 @@ Public Sub TableView_Data(Row As Integer, Column As Integer)
|
|||
Dim iIndex As Integer
|
||||
Dim iType As Integer
|
||||
Dim vVal As Variant
|
||||
Dim hFont As Font
|
||||
'Dim hFont As Font
|
||||
|
||||
If $iNoRefresh Then Return
|
||||
|
||||
|
@ -405,9 +405,6 @@ Public Sub TableView_Data(Row As Integer, Column As Integer)
|
|||
iType = $aType[Column].Type
|
||||
If iType = db.Blob Then
|
||||
.Text = "Blob"
|
||||
hFont = .Font
|
||||
hFont.Bold = True
|
||||
.Font = hFont
|
||||
.Foreground = Color.LightForeground
|
||||
Return
|
||||
Else If iType = db.Integer Or If iType = db.Float Then
|
||||
|
@ -1234,14 +1231,11 @@ End
|
|||
|
||||
Public Sub ButtonBox_Click()
|
||||
|
||||
Dim sData As String
|
||||
|
||||
sData = FBlobEditor.Run($hTable[$hCtrl.Row][$aColumnsIndex[$hCtrl.Column]].Data, $aColumns[$hCtrl.Column], CanEdit())
|
||||
If CanEdit() Then
|
||||
Inc Application.Busy
|
||||
TableView_Save($hCtrl.Row, $hCtrl.Column, sData)
|
||||
Dec Application.Busy
|
||||
Endif
|
||||
If FBlobEditor.Run($hTable[$hCtrl.Row][$aColumnsIndex[$hCtrl.Column]].Data, $aColumns[$hCtrl.Column], CanEdit()) Then Return
|
||||
Inc Application.Busy
|
||||
TableView_Save($hCtrl.Row, $hCtrl.Column, FBlobEditor.Data)
|
||||
FBlobEditor.Data = ""
|
||||
Dec Application.Busy
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -2,17 +2,24 @@
|
|||
|
||||
Private Const BY_LINE As Integer = 16
|
||||
|
||||
Static Public Data As String
|
||||
|
||||
Private $W As Integer
|
||||
Private $sData As String
|
||||
Private $sField As String
|
||||
Private $bCanEdit As Boolean
|
||||
|
||||
Private $iRow As Integer
|
||||
Private $iPos As Integer
|
||||
|
||||
Public Sub Run(sData As String, sField As String, bCanEdit As Boolean) As String
|
||||
Public Sub Run(sData As String, sField As String, bCanEdit As Boolean) As Boolean
|
||||
|
||||
$sData = sData
|
||||
$sField = sField
|
||||
$bCanEdit = bCanEdit
|
||||
Me.ShowDialog
|
||||
Return $sData
|
||||
If sData = $sData Then Return True
|
||||
Data = $sData
|
||||
|
||||
End
|
||||
|
||||
|
@ -21,18 +28,21 @@ Private Sub RefreshView()
|
|||
|
||||
lblSize.Text = Subst("&1 byte(s)", Format(Len($sData), ",0")) & " "
|
||||
gvwPreview.Rows.Count = (Len($sData) + BY_LINE - 1) \ BY_LINE
|
||||
$iRow = -1
|
||||
|
||||
End
|
||||
|
||||
Public Sub Form_Open()
|
||||
|
||||
$W = gvwPreview.Font.TextWidth("0")
|
||||
|
||||
gvwPreview.Columns.Count = 4
|
||||
gvwPreview.Columns[0].W = gvwPreview.Font.TextWidth("0") * 10
|
||||
gvwPreview.Columns[0].W = $W * 10
|
||||
gvwPreview.Columns[0].Alignment = Align.Right
|
||||
gvwPreview.Columns[1].W = Desktop.Scale * 2
|
||||
gvwPreview.Columns[2].W = gvwPreview.Font.TextWidth("0") * BY_LINE * 3 + Desktop.Scale * 2
|
||||
gvwPreview.Columns[2].W = $W * BY_LINE * 3 + Desktop.Scale * 2
|
||||
|
||||
Me.W = gvwPreview.Font.TextWidth("0") * (BY_LINE * 4 + 10) + Desktop.Scale * 9
|
||||
Me.W = $W * (BY_LINE * 4 + 10) + Desktop.Scale * 9
|
||||
|
||||
If Not $bCanEdit Then
|
||||
btnLoad.Hide
|
||||
|
@ -43,45 +53,56 @@ Public Sub Form_Open()
|
|||
|
||||
End
|
||||
|
||||
Public Sub gvwPreview_Data(Row As Integer, Column As Integer)
|
||||
Public Sub gvwPreview_MouseMove()
|
||||
|
||||
Dim iRow As Integer
|
||||
Dim iCol As Integer
|
||||
Dim iPos As Integer
|
||||
Dim sText As String
|
||||
Dim I As Integer
|
||||
Dim sCar As String
|
||||
|
||||
iPos = Row * BY_LINE
|
||||
Dim X, Y As Integer
|
||||
|
||||
Select Case Column
|
||||
|
||||
Case 0
|
||||
sText = CStr(iPos)
|
||||
|
||||
Case 1
|
||||
|
||||
Try X = Mouse.X
|
||||
If Error Then
|
||||
X = Mouse.ScreenX - gvwPreview.ScreenX
|
||||
Y = Mouse.ScreenY - gvwPreview.ScreenY
|
||||
Else
|
||||
Y = Mouse.Y
|
||||
Endif
|
||||
|
||||
iRow = gvwPreview.RowAt(Mouse.Y)
|
||||
iCol = gvwPreview.ColumnAt(Mouse.X)
|
||||
|
||||
Select Case iCol
|
||||
Case 2
|
||||
iRow = iRow
|
||||
iPos = (Mouse.X - gvwPreview.Columns[iCol].X) \ ($W * 3)
|
||||
Case 3
|
||||
iRow = iRow
|
||||
iPos = (Mouse.X - gvwPreview.Columns[iCol].X) \ $W
|
||||
Case Else
|
||||
|
||||
For I = iPos + 1 To Min(Len($sData), iPos + BY_LINE)
|
||||
|
||||
sCar = Mid$($sData, I, 1)
|
||||
If Column = 2 Then
|
||||
sText &= Hex$(Asc(sCar), 2) & " "
|
||||
Else
|
||||
If Asc(sCar) >= 32 And If Asc(sCar) <= 127 Then
|
||||
sText &= sCar
|
||||
Else
|
||||
sText &= "."
|
||||
Endif
|
||||
Endif
|
||||
|
||||
Next
|
||||
|
||||
iRow = -1
|
||||
End Select
|
||||
|
||||
gvwPreview.Data.Text = sText
|
||||
|
||||
iPos = Max(0, Min(BY_LINE - 1, iPos))
|
||||
If iRow >= 0 And If (iRow * BY_LINE + iPos) > Len($sData) Then iRow = -1
|
||||
|
||||
If iRow <> $iRow Or If iPos <> $iPos Then
|
||||
$iRow = iRow
|
||||
$iPos = iPos
|
||||
gvwPreview.Rows[$iRow].Refresh
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub gvwPreview_Leave()
|
||||
|
||||
If $iRow >= 0 Then
|
||||
$iRow = -1
|
||||
gvwPreview.Rows[$iRow].Refresh
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Sub Warning(sTitle As String, Optional sMsg As String, Optional bError As Boolean)
|
||||
|
||||
If Right(sTitle) <> "." Then sTitle &= "."
|
||||
|
@ -139,3 +160,69 @@ Catch
|
|||
Warning(("Unable to clear blob"), Error.Text)
|
||||
|
||||
End
|
||||
|
||||
Public Sub gvwPreview_Draw(X As Integer, Y As Integer, Width As Integer, Height As Integer, Row As Integer, Column As Integer)
|
||||
|
||||
Dim iPos As Integer
|
||||
Dim sText As String
|
||||
Dim I As Integer
|
||||
Dim sCar As String
|
||||
Dim SX As Integer
|
||||
|
||||
Paint.Background = Color.TextForeground
|
||||
|
||||
iPos = Row * BY_LINE
|
||||
|
||||
Select Case Column
|
||||
|
||||
Case 0
|
||||
sText = CStr(iPos)
|
||||
Paint.DrawText(sText, X, Y, Width, Height, Align.Right)
|
||||
|
||||
Case 1
|
||||
Return
|
||||
|
||||
Case 2
|
||||
|
||||
SX = X
|
||||
For I = iPos + 1 To Min(Len($sData), iPos + BY_LINE)
|
||||
|
||||
sCar = Hex$(Asc($sData, I), 2)
|
||||
Paint.DrawText(sCar, SX, Y, Width, Height, Align.Left)
|
||||
SX += $W * 3
|
||||
|
||||
Next
|
||||
|
||||
Case 3
|
||||
|
||||
SX = X
|
||||
For I = iPos + 1 To Min(Len($sData), iPos + BY_LINE)
|
||||
|
||||
sCar = Mid$($sData, I, 1)
|
||||
If Asc(sCar) < 32 Or If Asc(sCar) >= 127 Then sCar = "."
|
||||
Paint.DrawText(sCar, SX, Y, Width, Height, Align.Left)
|
||||
SX += $W
|
||||
|
||||
Next
|
||||
|
||||
End Select
|
||||
|
||||
If $iRow = Row Then
|
||||
If Column = 2 Then
|
||||
Paint.Background = Color.SetAlpha(Color.SelectedBackground, 128)
|
||||
Paint.Rectangle(X + $iPos * $W * 3, Y, $W * 2, Height)
|
||||
Paint.Fill
|
||||
Else If Column = 3 Then
|
||||
Paint.Background = Color.SetAlpha(Color.SelectedBackground, 128)
|
||||
Paint.Rectangle(X + $iPos * $W, Y, $W, Height)
|
||||
Paint.Fill
|
||||
Endif
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub gvwPreview_Scroll()
|
||||
|
||||
gvwPreview_MouseMove
|
||||
|
||||
End
|
||||
|
|
|
@ -36,9 +36,11 @@
|
|||
{ gvwPreview GridView
|
||||
MoveScaled(5,11,47,40)
|
||||
Font = Font["Monospace"]
|
||||
Mouse = Mouse.Pointing
|
||||
Expand = True
|
||||
Border = False
|
||||
Grid = False
|
||||
ScrollBar = Scroll.Vertical
|
||||
}
|
||||
{ Separator2 Separator
|
||||
MoveScaled(5,53,15,0)
|
||||
|
|
|
@ -183,35 +183,39 @@ Public Sub SetOrientation(iOrientation As Integer)
|
|||
Select Case iOrientation
|
||||
Case Align.Top
|
||||
sepBrowser.H = 1
|
||||
panBrowser.Raise
|
||||
sepBrowser.Raise
|
||||
dvwBrowser.Raise
|
||||
'panBrowser.Raise
|
||||
'sepBrowser.Raise
|
||||
'dvwBrowser.Raise
|
||||
panBrowser.H = $W
|
||||
panBrowser.Arrangement = Arrange.Horizontal
|
||||
panBorder.Invert = True
|
||||
panBorder.Arrangement = Arrange.Vertical
|
||||
Case Align.Bottom
|
||||
sepBrowser.H = 1
|
||||
dvwBrowser.Raise
|
||||
sepBrowser.Raise
|
||||
panBrowser.Raise
|
||||
'dvwBrowser.Raise
|
||||
'sepBrowser.Raise
|
||||
'panBrowser.Raise
|
||||
panBrowser.H = $W
|
||||
panBrowser.Arrangement = Arrange.Horizontal
|
||||
panBorder.Invert = False
|
||||
panBorder.Arrangement = Arrange.Vertical
|
||||
Case Align.Left
|
||||
sepBrowser.W = 1
|
||||
panBrowser.Raise
|
||||
sepBrowser.Raise
|
||||
dvwBrowser.Raise
|
||||
'panBrowser.Raise
|
||||
'sepBrowser.Raise
|
||||
'dvwBrowser.Raise
|
||||
panBrowser.W = $W
|
||||
panBrowser.Arrangement = Arrange.Vertical
|
||||
panBorder.Invert = True
|
||||
panBorder.Arrangement = Arrange.Horizontal
|
||||
Case Align.Right
|
||||
sepBrowser.W = 1
|
||||
dvwBrowser.Raise
|
||||
sepBrowser.Raise
|
||||
panBrowser.Raise
|
||||
'dvwBrowser.Raise
|
||||
'sepBrowser.Raise
|
||||
'panBrowser.Raise
|
||||
panBrowser.W = $W
|
||||
panBrowser.Arrangement = Arrange.Vertical
|
||||
panBorder.Invert = False
|
||||
panBorder.Arrangement = Arrange.Horizontal
|
||||
Default
|
||||
Return
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
MoveScaled(8,16,13,0)
|
||||
}
|
||||
{ panBrowser Panel
|
||||
MoveScaled(0,17,34,4)
|
||||
MoveScaled(1,17,34,4)
|
||||
Arrangement = Arrange.Horizontal
|
||||
{ btnNew ToolButton
|
||||
MoveScaled(0,0,4,4)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Public Sub Form_Open()
|
||||
|
||||
'DB.Debug = True
|
||||
DB.Debug = True
|
||||
'DataSource2.Connection = DB.Current
|
||||
|
||||
End
|
||||
|
@ -55,6 +55,6 @@ End
|
|||
|
||||
Public Sub DataSource1_BeforeSave(Data As Result)
|
||||
|
||||
Data["color"] = DataSource2["color"]
|
||||
If DataSource2["color"] Then Data["color"] = DataSource2["color"]
|
||||
|
||||
End
|
||||
|
|
|
@ -24,98 +24,109 @@
|
|||
Grid = True
|
||||
}
|
||||
{ DataSource1 DataSource
|
||||
MoveScaled(2,19,62,67)
|
||||
MoveScaled(2,19,64,67)
|
||||
Expand = True
|
||||
Arrangement = Arrange.Vertical
|
||||
Arrangement = Arrange.Fill
|
||||
Spacing = True
|
||||
Table = "test"
|
||||
{ DataBrowser1 DataBrowser
|
||||
MoveScaled(2,5,59,17)
|
||||
Font = Font["-1"]
|
||||
Expand = True
|
||||
Columns = ["id", "active", "color", "firstname", "salary", "birth", "comment"]
|
||||
Editable = True
|
||||
Grid = True
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(2,23,59,43)
|
||||
Spacing = True
|
||||
{ VBox2 VBox
|
||||
MoveScaled(1,1,12,35)
|
||||
Spacing = True
|
||||
{ Label1 Label
|
||||
MoveScaled(1,3,9,4)
|
||||
Text = ("Id")
|
||||
}
|
||||
{ Label9 Label
|
||||
MoveScaled(1,7,9,4)
|
||||
Text = ("Color")
|
||||
}
|
||||
{ Label2 Label
|
||||
MoveScaled(1,11,9,4)
|
||||
Text = ("First Name")
|
||||
}
|
||||
{ Label3 Label
|
||||
MoveScaled(1,15,9,4)
|
||||
Text = ("Name")
|
||||
}
|
||||
{ Label4 Label
|
||||
MoveScaled(1,19,9,4)
|
||||
Text = ("Birth")
|
||||
}
|
||||
{ Label5 Label
|
||||
MoveScaled(1,23,9,4)
|
||||
Text = ("Active")
|
||||
}
|
||||
{ Label8 Label
|
||||
MoveScaled(1,27,9,4)
|
||||
Expand = True
|
||||
Text = ("Comment")
|
||||
Alignment = Align.TopNormal
|
||||
}
|
||||
{ Label6 Label
|
||||
MoveScaled(1,31,9,4)
|
||||
Text = ("Salary")
|
||||
}
|
||||
}
|
||||
{ VBox1 VBox
|
||||
MoveScaled(14,1,44,40)
|
||||
{ Panel1 VSplit
|
||||
MoveScaled(1,2,62,64)
|
||||
{ DataBrowser1 DataBrowser
|
||||
MoveScaled(2,3,55,14)
|
||||
Font = Font["-1"]
|
||||
Expand = True
|
||||
Columns = ["id", "active", "color", "firstname", "salary", "birth", "image", "comment"]
|
||||
Editable = True
|
||||
Grid = True
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(1,19,59,43)
|
||||
Spacing = True
|
||||
{ DataControl1 DataControl
|
||||
MoveScaled(1,1,30,4)
|
||||
Field = "id"
|
||||
{ VBox2 VBox
|
||||
MoveScaled(1,1,12,40)
|
||||
Spacing = True
|
||||
{ Label1 Label
|
||||
MoveScaled(1,3,9,4)
|
||||
Text = ("Id")
|
||||
}
|
||||
{ Label9 Label
|
||||
MoveScaled(1,7,9,4)
|
||||
Text = ("Color")
|
||||
}
|
||||
{ Label2 Label
|
||||
MoveScaled(1,11,9,4)
|
||||
Text = ("First Name")
|
||||
}
|
||||
{ Label3 Label
|
||||
MoveScaled(1,15,9,4)
|
||||
Text = ("Name")
|
||||
}
|
||||
{ Label4 Label
|
||||
MoveScaled(1,19,9,4)
|
||||
Text = ("Birth")
|
||||
}
|
||||
{ Label5 Label
|
||||
MoveScaled(1,23,9,4)
|
||||
Text = ("Active")
|
||||
}
|
||||
{ Label8 Label
|
||||
MoveScaled(1,27,9,4)
|
||||
Expand = True
|
||||
Text = ("Comment")
|
||||
Alignment = Align.TopNormal
|
||||
}
|
||||
{ Label6 Label
|
||||
MoveScaled(1,31,9,4)
|
||||
Text = ("Salary")
|
||||
}
|
||||
{ Label7 Label
|
||||
MoveScaled(1,35,9,4)
|
||||
Text = ("Image")
|
||||
}
|
||||
}
|
||||
{ DataCombo1 DataCombo
|
||||
MoveScaled(1,6,38,4)
|
||||
Field = "color"
|
||||
Table = "color"
|
||||
Display = "french"
|
||||
}
|
||||
{ DataControl2 DataControl
|
||||
MoveScaled(1,11,30,4)
|
||||
Field = "firstname"
|
||||
}
|
||||
{ DataControl3 DataControl
|
||||
MoveScaled(1,15,30,4)
|
||||
Field = "name"
|
||||
}
|
||||
{ DataControl4 DataControl
|
||||
MoveScaled(1,19,30,4)
|
||||
Field = "birth"
|
||||
}
|
||||
{ DataControl5 DataControl
|
||||
MoveScaled(1,23,30,4)
|
||||
Field = "active"
|
||||
}
|
||||
{ DataControl7 DataControl
|
||||
MoveScaled(1,27,42,4)
|
||||
{ VBox1 VBox
|
||||
MoveScaled(14,1,44,40)
|
||||
Expand = True
|
||||
Field = "comment"
|
||||
}
|
||||
{ DataControl6 DataControl
|
||||
MoveScaled(1,31,30,4)
|
||||
Field = "salary"
|
||||
Spacing = True
|
||||
{ DataControl1 DataControl
|
||||
MoveScaled(1,1,30,4)
|
||||
Field = "id"
|
||||
}
|
||||
{ DataCombo1 DataCombo
|
||||
MoveScaled(1,6,38,4)
|
||||
Field = "color"
|
||||
Table = "color"
|
||||
Display = "french"
|
||||
}
|
||||
{ DataControl2 DataControl
|
||||
MoveScaled(1,11,30,4)
|
||||
Field = "firstname"
|
||||
}
|
||||
{ DataControl3 DataControl
|
||||
MoveScaled(1,15,30,4)
|
||||
Field = "name"
|
||||
}
|
||||
{ DataControl4 DataControl
|
||||
MoveScaled(1,19,30,4)
|
||||
Field = "birth"
|
||||
}
|
||||
{ DataControl5 DataControl
|
||||
MoveScaled(1,23,30,4)
|
||||
Field = "active"
|
||||
}
|
||||
{ DataControl7 DataControl
|
||||
MoveScaled(1,27,42,4)
|
||||
Expand = True
|
||||
Field = "comment"
|
||||
}
|
||||
{ DataControl6 DataControl
|
||||
MoveScaled(1,31,30,4)
|
||||
Field = "salary"
|
||||
}
|
||||
{ DataControl8 DataControl
|
||||
MoveScaled(1,35,30,4)
|
||||
Field = "image"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,10 @@ Text
|
|||
p
|
||||
s
|
||||
|
||||
Pos
|
||||
p
|
||||
i
|
||||
|
||||
Length
|
||||
r
|
||||
i
|
||||
|
|
|
@ -15,6 +15,7 @@ Event Activate
|
|||
|
||||
Property Picture As Picture
|
||||
Property Text As String
|
||||
Property Pos As Integer
|
||||
Property Read Length As Integer
|
||||
Property ReadOnly As Boolean
|
||||
Property Border As Boolean
|
||||
|
@ -255,3 +256,15 @@ Public Sub _AddButton(hButton As ToolButton)
|
|||
hButton.Reparent($hBackground)
|
||||
|
||||
End
|
||||
|
||||
Private Function Pos_Read() As Integer
|
||||
|
||||
Return $hTextBox.Pos
|
||||
|
||||
End
|
||||
|
||||
Private Sub Pos_Write(Value As Integer)
|
||||
|
||||
$hTextBox.Pos = Value
|
||||
|
||||
End
|
||||
|
|
|
@ -359,7 +359,7 @@ Public Sub Editor_KeyPress()
|
|||
Case Key.Left
|
||||
If $bNoKeyboard Then Return
|
||||
If Not Key.Normal Then Return
|
||||
If $bTextBox And If $hEditor.Pos > 0 Then Return
|
||||
If $bTextBox And If Not $hEditor.ReadOnly And If $hEditor.Pos > 0 Then Return
|
||||
|
||||
If SaveEditor() Then
|
||||
Stop Event
|
||||
|
@ -386,7 +386,7 @@ Public Sub Editor_KeyPress()
|
|||
Case Key.Right
|
||||
If $bNoKeyboard Then Return
|
||||
If Not Key.Normal Then Return
|
||||
If $bTextBox And If $hEditor.Pos < $hEditor.Length Then Return
|
||||
If $bTextBox And If Not $hEditor.ReadOnly And If $hEditor.Pos < $hEditor.Length Then Return
|
||||
|
||||
If SaveEditor() Then
|
||||
Stop Event
|
||||
|
|
|
@ -888,6 +888,7 @@ static int query_fill(DB_DATABASE *db, DB_RESULT result, int pos, GB_VARIANT_VAL
|
|||
int i;
|
||||
const char *data;
|
||||
GB_VARIANT value;
|
||||
fType type;
|
||||
|
||||
if (!next)
|
||||
res->seek(pos); /* move to record */
|
||||
|
@ -896,8 +897,9 @@ static int query_fill(DB_DATABASE *db, DB_RESULT result, int pos, GB_VARIANT_VAL
|
|||
|
||||
for (i = 0; i < res->fieldCount(); i++)
|
||||
{
|
||||
//GB.NewString( &data, res->fv(res->fieldName(i)).get_asString().data(),0);
|
||||
if (res->fv(i).get_isNull())
|
||||
type = (fType) res->fieldType(i);
|
||||
|
||||
if (type == ft_Blob || res->fv(i).get_isNull())
|
||||
data = NULL;
|
||||
else
|
||||
data = res->fv(i).get_asString().data();
|
||||
|
@ -909,7 +911,7 @@ static int query_fill(DB_DATABASE *db, DB_RESULT result, int pos, GB_VARIANT_VAL
|
|||
|
||||
//if (field->type != FIELD_TYPE_NULL)
|
||||
if (data)
|
||||
conv_data(data, &value.value, (fType) res->fieldType(i));
|
||||
conv_data(data, &value.value, type);
|
||||
|
||||
//GB.FreeString(&data);
|
||||
GB.StoreVariant(&value, &buffer[i]);
|
||||
|
|
Loading…
Reference in a new issue