You are not logged in.
Synopse,
First, let me thank you for all your work on mORMot. I've had it for years, but I didn't understand it because I didn't take the time to investigate it, but recently, I've been looking to abstract the presentation layer of a Delphi program that I wrote in 2004, and I've been maintaining ever since that is tightly bound to the database engine.
Years ago I created an owner measured and drawn DBLookupListBox alternative using large portions of the code from the DBCtrls unit. I'm not ready to completely ditch the look and feel of this in favor of the mORMot TDrawGrid just yet, so I was wondering if you'd be able to point me toward a way to connect a mORMot table to a TDatasource, or suggest some way to get the same functionality. If you paste the form components below onto a new form, you will see the general idea of my design (I changed my custom DBLookupListBox alternative into a TDBLookupListBox so that you can see what it would look like). I inherit from the form that results from the code below, and then add the functionality to communicate with the database in the descendant.
Sincerely,
Brain Cell
This code is from Delphi 2005 (which is the one that I could afford at the time)
object PickListSplitter: TSplitter
Left = 165
Top = 26
Height = 145
end
object DetailsBox: TGroupBox
Left = 168
Top = 26
Width = 493
Height = 145
Align = alClient
Caption = ' Information Details '
TabOrder = 3
object memoDetails: TRichEdit
Left = 2
Top = 15
Width = 489
Height = 128
Align = alClient
BorderStyle = bsNone
Color = clMenu
PopupMenu = menuDetailsContext
ReadOnly = True
TabOrder = 0
end
end
object gbPickList: TGroupBox
Left = 0
Top = 26
Width = 165
Height = 145
Align = alLeft
Caption = ' Pick List '
TabOrder = 0
object dbPickList: TDBLookupListBox
Left = 2
Top = 15
Width = 161
Height = 128
Align = alClient
BorderStyle = bsNone
ListSource = dsPickList
ParentColor = True
TabOrder = 0
OnDblClick = dbPickListDblClick
end
end
object pnlSearch: TPanel
Left = 366
Top = 39
Width = 289
Height = 29
Anchors = [akTop, akRight]
TabOrder = 1
Visible = False
object lblSearch: TLabel
Left = 8
Top = 7
Width = 52
Height = 13
Caption = 'Search for:'
end
object edtSearch: TEdit
Left = 85
Top = 4
Width = 121
Height = 21
TabOrder = 0
end
object btnSearch: TBitBtn
Left = 208
Top = 4
Width = 75
Height = 21
Caption = 'Go !'
TabOrder = 1
end
end
object ControlBar1: TControlBar
Left = 0
Top = 0
Width = 661
Height = 26
Align = alTop
BevelEdges = []
BevelInner = bvNone
BevelOuter = bvNone
BevelKind = bkNone
TabOrder = 2
object ToolBar: TToolBar
Left = 11
Top = 2
Width = 529
Height = 22
Align = alNone
AutoSize = True
ButtonHeight = 20
ButtonWidth = 40
Color = clBtnFace
EdgeBorders = [ebRight]
EdgeInner = esNone
EdgeOuter = esNone
ParentColor = False
TabOrder = 0
DesignSize = (
529
22)
object btnNew: TSpeedButton
Left = 0
Top = 2
Width = 70
Height = 20
Action = actNew
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnEdit: TSpeedButton
Left = 70
Top = 2
Width = 58
Height = 20
Action = actEdit
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnDelete: TSpeedButton
Left = 128
Top = 2
Width = 70
Height = 20
Action = actDelete
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnFind: TSpeedButton
Left = 198
Top = 2
Width = 70
Height = 20
Action = actFind
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnShowAll: TSpeedButton
Left = 268
Top = 2
Width = 70
Height = 20
Action = actShowAll
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnSortBy: TSpeedButton
Left = 338
Top = 2
Width = 53
Height = 20
Action = actSortBy
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnPrint: TSpeedButton
Left = 391
Top = 2
Width = 70
Height = 20
Action = actPrint
AllowAllUp = True
Anchors = [akTop]
Flat = True
NumGlyphs = 2
end
object btnExit: TSpeedButton
Left = 461
Top = 2
Width = 68
Height = 20
Action = actExit
AllowAllUp = True
Anchors = [akTop, akRight]
Flat = True
end
end
end
object dsPickList: TDataSource
OnDataChange = dsPickListDataChange
Left = 4
Top = 40
end
object tmrShowDetails: TTimer
Enabled = False
Interval = 250
Left = 68
Top = 40
end
object menuDetailsContext: TPopupMenu
Left = 100
Top = 40
object miCopy: TMenuItem
Action = actEditCopy
end
object miSelectAll: TMenuItem
Action = actEditSelectAll
end
object miPrint: TMenuItem
Action = actEditPrint
end
end
object EditMenuActions: TActionList
Left = 36
Top = 40
object actNew: TAction
Category = 'Toolbar'
Caption = 'New (Ins)'
ShortCut = 45
end
object actEdit: TAction
Category = 'Toolbar'
Caption = 'Edit'
end
object actDelete: TAction
Category = 'Toolbar'
Caption = 'Delete (Del)'
ShortCut = 46
end
object actFind: TAction
Category = 'Toolbar'
Caption = '&Find'
ShortCut = 114
end
object actShowAll: TAction
Category = 'Toolbar'
Caption = '&Show all'
end
object actSortBy: TAction
Category = 'Toolbar'
Caption = 'S&ort By'
end
object actPrint: TAction
Category = 'Toolbar'
Caption = '&Print'
end
object actExit: TAction
Category = 'Toolbar'
Caption = 'E&xit'
ShortCut = 32856
OnExecute = actExitExecute
end
object actEditCopy: TEditCopy
Category = 'Edit'
Caption = '&Copy'
Hint = 'Copy'
ShortCut = 16451
end
object actEditSelectAll: TEditSelectAll
Category = 'Edit'
Caption = 'Select &All'
ShortCut = 16449
end
object actEditPrint: TAction
Category = 'Edit'
Caption = '&Print'
ShortCut = 16464
end
end
object EditTimer: TTimer
Enabled = False
Interval = 100
OnTimer = EditTimerTimer
Left = 172
Top = 40
end
Offline
Please follow the forum rules, and don't paste extensive amount of code in the forum.
See https://synopse.info/forum/misc.php?action=rules
Did you search the documentation about TDataSource?
You would have found for instance the https://synopse.info/files/html/api-1.18/mORMotVCL.html unit.
Offline