-
Feb 16th, 2018, 12:11 PM
#1
"Grid" control special requirement - Options?
I'm working on some projects that have sets of display-only (non-editable) information where each set contains 10 or less item values and there would normally be 0 to maybe 16 sets (maximum).
Most of the time there will only be one set, and even when there are multiple sets only one at a time is of interest.
While I could use one of the FlexGrids, or a DataGrid in read-only mode, or even a ListView in Report mode those would take up more space on a Form than I want.
So I am working on a thing I am calling a Griddle ("little grid?"). This is sort of like a FlexGrid control but items in a "set" of data are vertical (like a ListBox), "sets" (or "rows") go horizontally but only one at a time is in view, and item labels stay fixed at the left when you scroll left or right among the sets of item values.
Again: In this case "rows" scroll horizontally and "column" values are shown vertically, unlike a typical grid display. Only one "row" is displayed at any time.
This isn't finished yet.
If practical I'll probably add UxTheme styles when the Common Controls 6.x assembly has been selected via manifest. I may end up making it a complex-bound UserControl allowing other data sources besides raw ADO Recordsets but that isn't a priority for me. It could also be hacked to use a Variant array of Variant arrays instead of a Recordset too.
My question:
Is there another control I can use that behaves like this? I drew a blank but maybe I missed the obvious. I wanted something like a DataRepeater but with horizontal scrolling rather than vertical scrolling... but I suppose that could work as well.
Suggestions?
-
Feb 16th, 2018, 12:24 PM
#2
Re: "Grid" control special requirement - Options?
BTW: A FlexGrid could work fine I suppose after all. Just adjust column widths so that only one "column" fits and scroll left/right among them.
So aside from the UxTheme "skinning" you can't do on a FlexGrid, it would probably be a decent enough option after all. I'll have to consider that.
Why reinvent the wheel?
I'd just need to invert the Recordset data and plop the former columns' names into column 0 of the grid.
Last edited by dilettante; Feb 16th, 2018 at 12:28 PM.
-
Feb 16th, 2018, 01:14 PM
#3
Re: "Grid" control special requirement - Options?
Hi,
a simple way would to save the Data "vertically" like the way you want to display it.
the use the Data like a Page
a Listview would look better, the Listbox is just a demo
the Database Table would need 3 Columns
ID Text Discription
some code do execute the paging..
Code:
Option Explicit
Dim db As Connection
Dim lCurrentPage As Long
Private Sub cmdNext_Click()
lCurrentPage = lCurrentPage + 1
Call LoadListBox(lCurrentPage)
End Sub
Private Sub cmdPrevious_Click()
If lCurrentPage > 1 Then
lCurrentPage = lCurrentPage - 1
Call LoadListBox(lCurrentPage)
End If
End Sub
Private Sub Form_Load()
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & AppPath & "test.mdb;"
lCurrentPage = 1
Call LoadListBox(lCurrentPage)
End Sub
Private Sub LoadListBox(lPage As Long)
Dim adoPrimaryRS As ADODB.Recordset
Dim lPageCount As Long
Dim nPageSize As Integer
Dim lCount As Long
nPageSize = 6
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from numbers", db, adOpenStatic, adLockOptimistic
adoPrimaryRS.PageSize = nPageSize
lPageCount = adoPrimaryRS.PageCount
If lCurrentPage > lPageCount Then
lCurrentPage = lPageCount
End If
txtPage.Text = lPage
adoPrimaryRS.AbsolutePage = lCurrentPage
With lbxRecords
.Clear
lCount = 0
Do While Not adoPrimaryRS.EOF
.AddItem adoPrimaryRS("aNumber") & Space(4) & adoPrimaryRS("Discription")
lCount = lCount + 1
If lCount = nPageSize Then
Exit Do
End If
adoPrimaryRS.MoveNext
Loop
End With
End Sub
regards
Chris
Last edited by ChrisE; Feb 16th, 2018 at 01:52 PM.
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
-
Feb 16th, 2018, 01:50 PM
#4
Re: "Grid" control special requirement - Options?
Originally Posted by dilettante
BTW: A FlexGrid could work fine I suppose after all. Just adjust column widths so that only one "column" fits and scroll left/right among them.
So aside from the UxTheme "skinning" you can't do on a FlexGrid, it would probably be a decent enough option after all. I'll have to consider that.
Why reinvent the wheel?
I'd just need to invert the Recordset data and plop the former columns' names into column 0 of the grid.
fwiw, that's what I would do. (use the mshflxgd)
It's not perfect but you can use appropriate system colors for the grid/fixed columns, and the scrollbars are already themed.
You can even handle the scrolling yourself using an intrinsic scrollbar.
Last edited by DEXWERX; Feb 16th, 2018 at 01:53 PM.
-
Feb 16th, 2018, 02:53 PM
#5
Re: "Grid" control special requirement - Options?
I'm already using system colors for the fixed cells. And I could easily switch to "flat" style cells for the values. Theming the scrollbar isn't required, that part is automatic. So maybe there isn't anything special to do unless I wanted to style the captions across the top and down the left to resemble ListView headings.
254KB for msflxgrd.ocx and 430KB for mhflxgd.ocx? Why bother if I can use my Griddle UserControl which is far smaller and internal?
If I didn't have it already close to finished I wouldn't bother though. Seems like a FlexGrid would be good enough.
Last edited by dilettante; Feb 16th, 2018 at 02:59 PM.
-
Feb 16th, 2018, 06:22 PM
#6
Re: "Grid" control special requirement - Options?
Originally Posted by dilettante
I'd just need to invert the Recordset data and plop the former columns' names into column 0 of the grid.
There is a great and advanced third-party grid control, the ComponentOne TrueDBGrid,
ComponentOne True DBGrid Pro 8
http://helpcentral.componentone.com/...bgridpro8.html
which allows you to invert columns in rows simply by setting the property DataView to 4:
ComponentOne True DBGrid Pro 8 - DataView Property
http://helpcentral.componentone.com/...wproperty.html
Last edited by gibra; Feb 16th, 2018 at 06:28 PM.
-
Feb 17th, 2018, 03:20 AM
#7
Re: "Grid" control special requirement - Options?
Originally Posted by dilettante
254KB for msflxgrd.ocx and 430KB for mhflxgd.ocx? Why bother if I can use my Griddle UserControl which is far smaller and internal?
If I didn't have it already close to finished I wouldn't bother though. Seems like a FlexGrid would be good enough.
Well msflxgrd.ocx can be replaced completly by my UserControl VBFlexGrid.
So you would have a internal FlexGrid then.
-
Feb 17th, 2018, 03:30 AM
#8
Re: "Grid" control special requirement - Options?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|