Fix 'Find()' and 'FindNext()' methods in DataSource and DataView, and add them to DataBrowser.
[GB.DB.FORM] * NEW: DataView: 'Find()' searches the entire view, whereas the new 'FindNext()' searches from the current index. * NEW: DataBrowser: Add 'Find()' and 'FindNext()' method from DataView. * BUG: DataSource: 'Find()' and 'FindNext()' methods now correctly detect the current connection.
This commit is contained in:
parent
d431251e2c
commit
13e65fa01d
@ -214,3 +214,16 @@ Public Sub Find(Where As String, ...)
|
||||
$hForm.DataView.Find(Where, ...)
|
||||
|
||||
End
|
||||
|
||||
Public Sub FindNext(Where As String, ...)
|
||||
|
||||
$hForm.DataView.FindNext(Where, ...)
|
||||
|
||||
End
|
||||
|
||||
Public Sub MoveTo(Index As Integer)
|
||||
|
||||
$hForm.DataView.MoveTo(Index)
|
||||
|
||||
End
|
||||
|
||||
|
@ -573,13 +573,13 @@ End
|
||||
|
||||
Public Function Find(Where As String, ...) As Integer
|
||||
|
||||
Return $hTable.Find($DB.Subst(Where, ...))
|
||||
Return $hTable.Find(_GetDB().Subst(Where, ...))
|
||||
|
||||
End
|
||||
|
||||
Public Function FindNext(Index As Integer, Where As String, ...) As Integer
|
||||
|
||||
Return $hTable.Find($DB.Subst(Where, ...), Index)
|
||||
Return $hTable.Find(_GetDB().Subst(Where, ...), Index)
|
||||
|
||||
End
|
||||
|
||||
|
@ -1308,6 +1308,15 @@ Public Sub Find(Where As String, ...)
|
||||
|
||||
Dim iIndex As Integer
|
||||
|
||||
iIndex = GetSource().Find(Where, ...)
|
||||
MoveTo(iIndex)
|
||||
|
||||
End
|
||||
|
||||
Public Sub FindNext(Where As String, ...)
|
||||
|
||||
Dim iIndex As Integer
|
||||
|
||||
iIndex = GetSource().FindNext(Index_Read() + 1, Where, ...)
|
||||
MoveTo(iIndex)
|
||||
|
||||
|
@ -71,7 +71,7 @@ Public Sub DataSource1_BeforeDelete(Keys As Variant[])
|
||||
Next
|
||||
Print
|
||||
|
||||
Stop Event
|
||||
'Stop Event
|
||||
|
||||
End
|
||||
|
||||
@ -81,3 +81,22 @@ Public Sub DataSource1_Invalid(Field As String)
|
||||
Stop Event
|
||||
|
||||
End
|
||||
|
||||
Public Sub Button2_Click()
|
||||
|
||||
DataBrowser1.MoveTo(2)
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnFind_Click()
|
||||
|
||||
Dim iId As Integer
|
||||
|
||||
Try iId = CInt(txtId.Text)
|
||||
If iId = 0 Then Return
|
||||
|
||||
iId = DataSource1.Find("id = &1", iId)
|
||||
'DataSource1.MoveTo(iId)
|
||||
DataBrowser1.MoveTo(iId)
|
||||
|
||||
End
|
||||
|
@ -6,10 +6,25 @@
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ Button1 Button
|
||||
MoveScaled(1,0,16,4)
|
||||
Visible = False
|
||||
Text = ("Refresh")
|
||||
{ Panel2 HBox
|
||||
MoveScaled(1,0,72,4)
|
||||
Spacing = True
|
||||
{ Button1 Button
|
||||
MoveScaled(0,0,16,4)
|
||||
Visible = False
|
||||
Text = ("Refresh")
|
||||
}
|
||||
{ Button2 Button
|
||||
MoveScaled(17,0,16,4)
|
||||
Text = ("Move")
|
||||
}
|
||||
{ txtId TextBox
|
||||
MoveScaled(34,0,15,4)
|
||||
}
|
||||
{ btnFind Button
|
||||
MoveScaled(51,0,16,4)
|
||||
Text = ("Find")
|
||||
}
|
||||
}
|
||||
{ DataSource2 DataSource
|
||||
MoveScaled(3,5,69,87)
|
||||
|
Loading…
x
Reference in New Issue
Block a user