[GB.DB.FORM]
* NEW: DataSource: Raise a new BeforeDelete event just before trying to delete a record. Cancel that event to cancel the deletion. * BUG: DataView: The new record mark is correctly managed now. [GB.GUI.BASE] * BUG: GridView: correctly reset the row titles when the row count changes. * NEW: Make row header a little bit larger by default. git-svn-id: svn://localhost/gambas/trunk@6463 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
ebaf84261d
commit
3b32652f00
7 changed files with 49 additions and 15 deletions
|
@ -408,6 +408,10 @@ C
|
|||
:
|
||||
|
||||
(Data)Result;
|
||||
:BeforeDelete
|
||||
:
|
||||
|
||||
(Keys)Variant[];
|
||||
Connection
|
||||
p
|
||||
Connection
|
||||
|
@ -530,7 +534,7 @@ DataField
|
|||
(Key)s
|
||||
_DeleteCurrent
|
||||
m
|
||||
|
||||
b
|
||||
|
||||
Remove
|
||||
m
|
||||
|
|
|
@ -14,11 +14,11 @@ msgstr ""
|
|||
msgid "Data bound controls"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:96 DataView.class:453
|
||||
#: DataControl.class:96 DataView.class:454
|
||||
msgid "True"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:97 DataField.class:19 DataView.class:453
|
||||
#: DataControl.class:97 DataField.class:19 DataView.class:454
|
||||
msgid "False"
|
||||
msgstr ""
|
||||
|
||||
|
@ -26,27 +26,27 @@ msgstr ""
|
|||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
#: DataSource.class:405
|
||||
#: DataSource.class:406
|
||||
msgid "Invalid value."
|
||||
msgstr ""
|
||||
|
||||
#: DataSource.class:428
|
||||
#: DataSource.class:429
|
||||
msgid "You must fill all mandatory fields."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:724
|
||||
#: DataView.class:725
|
||||
msgid "Unable to save value."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:726
|
||||
#: DataView.class:727
|
||||
msgid "Incorrect value."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:889
|
||||
#: DataView.class:890
|
||||
msgid "Unable to save record."
|
||||
msgstr ""
|
||||
|
||||
#: DataView.class:1057
|
||||
#: DataView.class:1058
|
||||
msgid "Unable to delete record."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ Inherits Panel
|
|||
|
||||
Event Change
|
||||
Event BeforeSave(Data As Result)
|
||||
Event BeforeDelete(Keys As Variant[])
|
||||
|
||||
Property Connection As Connection
|
||||
Property Table As String
|
||||
|
@ -488,16 +489,20 @@ Catch
|
|||
|
||||
End
|
||||
|
||||
Public Sub _DeleteCurrent()
|
||||
Public Sub _DeleteCurrent() As Boolean
|
||||
|
||||
Dim aVal As Variant[]
|
||||
Dim aKey As String[]
|
||||
Dim hSrc As DataSource
|
||||
Dim sKey As String
|
||||
Dim iPos As Integer
|
||||
Dim bCancel As Boolean
|
||||
|
||||
aVal = Me.Current
|
||||
If Not aVal Then Return
|
||||
If Not aVal Then Return True
|
||||
|
||||
bCancel = Raise BeforeDelete(Current_Read())
|
||||
If bCancel Then Return True
|
||||
|
||||
aKey = $hTable.Keys
|
||||
|
||||
|
@ -522,7 +527,7 @@ Public Function Remove() As Boolean
|
|||
Endif
|
||||
|
||||
If $iIndex >= 0 And $iIndex < $hTable.Count Then
|
||||
_DeleteCurrent()
|
||||
If _DeleteCurrent() Then Return
|
||||
Create(True)
|
||||
Else
|
||||
Create()
|
||||
|
|
|
@ -231,6 +231,7 @@ Private Sub Load()
|
|||
Inc $iNoRefresh
|
||||
'Object.Lock($hCtrl)
|
||||
$bNoActivate = True
|
||||
$hCtrl.Clear
|
||||
$hCtrl.Rows.Count = $hTable.Count
|
||||
$iRowNewRecord = -1
|
||||
'$hCtrl.Rows.H = GetDefaultRowHeight()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Public Sub Form_Open()
|
||||
|
||||
DB.Debug = True
|
||||
'DB.Debug = True
|
||||
'DataSource2.Connection = DB.Current
|
||||
|
||||
End
|
||||
|
@ -58,3 +58,17 @@ Public Sub DataSource1_BeforeSave(Data As Result)
|
|||
If DataSource2["color"] Then Data["color"] = DataSource2["color"]
|
||||
|
||||
End
|
||||
|
||||
Public Sub DataSource1_BeforeDelete(Keys As Variant[])
|
||||
|
||||
Dim vVal As Variant
|
||||
|
||||
Print "Before delete: ";
|
||||
For Each vVal In Keys
|
||||
Print vVal;;
|
||||
Next
|
||||
Print
|
||||
|
||||
Stop Event
|
||||
|
||||
End
|
||||
|
|
|
@ -497,7 +497,7 @@ Public Sub ScrollArea_Draw()
|
|||
Paint.Rectangle(X, Y + 1, W - F, H - 3)
|
||||
Paint.Clip
|
||||
If I = $iRow Then Paint.Font.Bold = True
|
||||
DrawText($hRows._GetRowText(I), X, Y + 2, W - F, H - 2, Align.Center, $iPadding)
|
||||
DrawText($hRows._GetRowText(I), X, Y + 2, W - F, H - 3, Align.Center, $iPadding)
|
||||
If I = $iRow Then Paint.Font.Bold = False
|
||||
Paint.Restore
|
||||
Endif
|
||||
|
|
|
@ -70,6 +70,15 @@ Private Sub Count_Write(Value As Integer)
|
|||
Wend
|
||||
Endif
|
||||
|
||||
If $cText Then
|
||||
For Each $cText
|
||||
If CInt($cText.Key) >= Value Then
|
||||
'Debug "Remove text from " & $cText.Key
|
||||
$cText.Remove($cText.Key)
|
||||
Endif
|
||||
Next
|
||||
Endif
|
||||
|
||||
If hView.Row >= $nRows Then hView.Row = -1
|
||||
|
||||
With hView
|
||||
|
@ -204,7 +213,7 @@ Private Function Width_Read() As Integer
|
|||
If $iWidth Then
|
||||
Return $iWidth
|
||||
Else
|
||||
Return Max(.Font.TextWidth("9"), .Font.TextWidth("0")) * (1 + CInt(Log10(Max(1, $nRows)))) + .Padding * 2 + 2
|
||||
Return Max(.Font.TextWidth("9"), .Font.TextWidth("0")) * (2 + CInt(Log10(Max(1, $nRows)))) + .Padding * 2 + 2
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
|
@ -420,6 +429,7 @@ Public Sub _Clear()
|
|||
If $cHeight Then
|
||||
$cHeight.Clear
|
||||
$aHeight.Clear
|
||||
If $cText Then $cText.Clear
|
||||
Endif
|
||||
|
||||
$hSel.UnSelectAll
|
||||
|
|
Loading…
Reference in a new issue