I've been reading the TMS Pack for Firemonkey Developers Guide on the TMSFMXTableView control but just can't seem to figure it out. I just want to populate it through a query, i.e., (select id, field1, field2 from table1) via livebindings.
When I bring up the livebindings designer, I can see the TMSFMXTableView component but there are no fields in its container to drag connecting lines to the query control, like your grid does, it auto fills in fields (or columns) and connects them and the grid then fills up with the data in the design window in real time. I want to do the same with the TableView control, if possible.
Right now, the control just displays its pre-defined values. I want to replace all that and just show my sqlite database data. As an experiment, I would like to see the first three fields: ID field on line 1 in bold, and then just underneath that, the remaining fields, and then repeat it for the rest of the records. Eventually, there will be a few more fields to add on the second row.
Included is a sample that demonstrates how to setup a LiveBindings connection, you can only link one field to the Caption, but you can write a query that combines 2 fields.
Thank you for the resource and solution. I am still exploring ideas for presenting the final data for viewing and also updating two fields in those views. So far, I've looked at your grid (both versions), and your TableView controls, and I've also looked at the standard TListView control. I had a look at each of these controls and tried various ways to display them and to be able to make updates to the query data. But it seems that the only control that I can update the query data, is through your grid. But the lack of scrolling in your grid stops me in dead in my tracks.
Your ListView has decent scrolling but I was not able to make any updates to the underlining table (actually, the query). I thought that I could update the data (two fields of the five that I would be displaying, I want to update: sel=true/false, and qty=integer) using your TableView control, but it doesn't seem possible. Much like the standard TListView control. Unless I am missing something there.
The project I'm working on is for the Android tablets. The standard TListView offers the best scrolling feature i've been but it too seems to be a view-only portal.
Is there any tricks or special techniques to make your grid look like it is scrolling somehow, like the TListView control ?
The TTMSFMXTableView is view-only LiveBindings connection. There is no editing involved. The TTMSFMXLiveGrid is the best grid implementation in combination with LiveBindings. You can try to improve performance by increasing the defaultrowheight / defaultcolumnwidth so less cells are visible. You can also turn on touch scrolling (TMSFMXLiveGrid1.Options.Mouse.TouchScrolling := True; But the scrolling isn't performed with inertia, By default the scrolling is set to cell scrolling, but perhaps you want to change this to pixelscrolling: TMSFMXLiveGrid1.ScrollMode := smPixelScrolling;
For testing purposes, I tried the LiveGrid with one column, and using your suggestion could not get smooth scrolling of any sort. It was jumpy, about 1 to 2 seconds it would scroll one row up or down depending on the direction that I swiped with the stylus pen on the android tablet. I tried several tablet brands, same result. There must be something I am missing.
The TTMSFMXTableView is designed with styling in mind and manages multiple objects. Currently, this isn't the correct approach anymore and a rewrite of this component without the object management should give a better performance. Android is the slowest environment, on the other platforms we haven't experienced issues. We have already implemented these techniques in the new TTMSFMXPlanner component. We will add this on our todolist for further investigation.
Pieter Scheldeman2015-06-04 08:36:24
Thank you, Pieter. Yes, I just tried it on a windows tablet (surface pro) and the scrolling works quite well. Actually, I've been showing demos under that platform because its much easier and quicker to do things in first. In windows. I think I will go with the LiveGrid for these demos. Thanks for taking the time in helping me. I know I will have other questions about livegrid and look forward to yours (TMS) assistance.
note: I'm still talking about the scrolling in the LiveGrid on a windows tablet.
>> I just tried it on a windows tablet (surface pro) and the scrolling works quite well.
I spoke too soon for the windows tablet. It seemed to work at first, on 1 or 2 column grid that was sized small, but then failed to scroll smoothly and consistently when I added more columns or re-sized the window or changed the Align property. Oh well. But I did try a slew of things to make it work, but with mixed results. Still nothing like a TListView scroll.
Next, I am retrying your regular FMXGrid. I think I recall it was better scrolling.
update - scrolling on your FMXGrid control.
It was successful. Not the same scrolling affect as when you "swing" the stylus pen up or down and the momentum continue the scrolling, depending on the (for the lack of correct term) strength of your up or down swing. Maybe there is a feature in the grid control to turn that on/off. Anyway. The scrolling was smooth and consistent. If this "swing" feature is not in the grid controls, maybe add that in, it would help in the scrolling when using the stylus pen on a windows tablet. I was using the Surface Pro for these tests. But I do have an 8 inch windows tablet that I will use for demo'ing things too.
Here's how I did it for the FMXGrid control:
1. select the grid control, then go into the Object Inspector window
2. scroll way down and change [ScrollMode: smPixelScrolling]
3. scroll down to +Options and under Mouse change to: (TouchScrolling=True; TouchScrollSensitivity=1; WheelScrollSize=1;
by default, TouchScrollSensitivity is set to 0.1
by default, WheelScrollSize is set to 4
I hope this helps others looking to improve scrolling in the FMXGrid control. And, who knows.., maybe update LiveGrid to the same scrolling functionality if that is recommended for database project.
Thank you for your feedback on this matter.