Common: Add support for Treelist, better api
This commit is contained in:
parent
9aae97c225
commit
adfb015b43
@ -16,6 +16,54 @@ Public Class GridBuilder
|
|||||||
Views.AddRange(GridViews)
|
Views.AddRange(GridViews)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetDefaults(ParamArray pGridViews As GridView())
|
||||||
|
For Each oView In pGridViews
|
||||||
|
WithDefaults(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetDefaults(ParamArray pTreeLists As TreeList())
|
||||||
|
For Each oView In pTreeLists
|
||||||
|
WithDefaults(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetReadOnlyOptions(ParamArray pGridViews As GridView())
|
||||||
|
For Each oView In pGridViews
|
||||||
|
WithReadOnlyOptions(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetReadOnlyOptions(ParamArray pTreeLists As TreeList())
|
||||||
|
For Each oView In pTreeLists
|
||||||
|
WithReadOnlyOptions(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetFontSizeDelta(pFontSizeDelta As Integer, ParamArray pGridViews As GridView())
|
||||||
|
For Each oView In pGridViews
|
||||||
|
WithFontSizeDelta(oView, pFontSizeDelta)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetFontSizeDelta(pFontSizeDelta As Integer, ParamArray pTreeLists As TreeList())
|
||||||
|
For Each oView In pTreeLists
|
||||||
|
WithFontSizeDelta(oView, pFontSizeDelta)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetClipboardHandler(ParamArray pGridViews As GridView())
|
||||||
|
For Each oView In pGridViews
|
||||||
|
WithClipboardHandler(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetClipboardHandler(ParamArray pTreeLists As TreeList())
|
||||||
|
For Each oView In pTreeLists
|
||||||
|
WithClipboardHandler(oView)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Applies common properties to all GridViews
|
''' Applies common properties to all GridViews
|
||||||
''' </summary>
|
''' </summary>
|
||||||
@ -101,6 +149,15 @@ Public Class GridBuilder
|
|||||||
Return Me
|
Return Me
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function WithFontSizeDelta(pTreeList As TreeList, pFontSizeDelta As Integer) As GridBuilder
|
||||||
|
pTreeList.Appearance.Row.FontSizeDelta = pFontSizeDelta
|
||||||
|
pTreeList.Appearance.GroupFooter.FontSizeDelta = pFontSizeDelta
|
||||||
|
pTreeList.Appearance.FilterPanel.FontSizeDelta = pFontSizeDelta
|
||||||
|
pTreeList.Appearance.HeaderPanel.FontSizeDelta = pFontSizeDelta
|
||||||
|
|
||||||
|
Return Me
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function WithClipboardHandler() As GridBuilder
|
Public Function WithClipboardHandler() As GridBuilder
|
||||||
For Each oGridView In Views
|
For Each oGridView In Views
|
||||||
WithClipboardHandler(oGridView)
|
WithClipboardHandler(oGridView)
|
||||||
@ -115,6 +172,23 @@ Public Class GridBuilder
|
|||||||
Return Me
|
Return Me
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function WithClipboardHandler(View As TreeList) As GridBuilder
|
||||||
|
AddHandler View.KeyDown, AddressOf TreeList_ClipboardHandler
|
||||||
|
|
||||||
|
Return Me
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub TreeList_ClipboardHandler(sender As Object, e As KeyEventArgs)
|
||||||
|
Dim view As TreeList = CType(sender, TreeList)
|
||||||
|
Dim oNode = view.FocusedNode
|
||||||
|
If e.Control AndAlso e.KeyCode = Keys.C Then
|
||||||
|
If view.GetRowCellValue(oNode, view.FocusedColumn) IsNot Nothing AndAlso view.GetRowCellValue(oNode, view.FocusedColumn).ToString() <> [String].Empty Then
|
||||||
|
Clipboard.SetText(view.GetRowCellValue(oNode, view.FocusedColumn).ToString())
|
||||||
|
End If
|
||||||
|
e.Handled = True
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub GridView_ClipboardHandler(sender As Object, e As KeyEventArgs)
|
Private Sub GridView_ClipboardHandler(sender As Object, e As KeyEventArgs)
|
||||||
Dim view As GridView = CType(sender, GridView)
|
Dim view As GridView = CType(sender, GridView)
|
||||||
If e.Control AndAlso e.KeyCode = Keys.C Then
|
If e.Control AndAlso e.KeyCode = Keys.C Then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user