Notice

The forum is in read only mode.

  • Page:
  • 1
  • 2

TOPIC: Controls inside Grids for Windows, Android and iOS

Controls inside Grids for Windows, Android and iOS 7 years 3 months ago #1873

Hi, I'm new to XE8 but maybe you can try creating a class based in TDBGrid and changing the canvas of each column to include the component you want to show in each column... I remember this was possible to do in old Delphi (ex. v7) without any problem... think it is possible now too, but wonder if it will work on the platforms you want to.

But same I wanted to leave this clue.

Controls inside Grids for Windows, Android and iOS 7 years 3 months ago #1882

Hi, and, yes, I need it for all platforms. I tried that idea last week. Its still in this projects code somewhere. But it didn't work and I after looking at the code in some detail in couldn't get it to work and moved on. I have no experience writing "class" type code. That was always beyond my skills level. The TMS component is the only alternative since it supports all four platforms which is what i need it for. Anyway. Since you have to first purchase the TMS component, I can't get any help or ask questions on their forum. I am, for lack of better words, stuck. I'm still searching for other company components with the inplace checkbox feature, but TMS seems to be the only one available.

Controls inside Grids for Windows, Android and iOS 7 years 3 months ago #1887

update..

I believe I may have figured out how the FMXGrid from TMS pack for Firemonkey works, finally. The columns auto-sort and there is no way to turn that off. Instead, you have to do the following:

1. In your table, add an unique numeric (primary key) id field, and call that in the grid as the first column.
2. Then, hide that column. But there doesn't appear to be a grid.hide.column(number) function. So, I set the column width to 1.

Now, the only problem I have in this project, is how to sync the data updates. You see, when i update the checkbox in the grid, and move to another record or refresh the query to the grid, the data is not updated in the database. So, the old data is still present.

To get around that, (after many hours and days of trial and error) I found a band-aid solution.

3. go into code view and locate the grid's OnCellCheckBoxClick() event, and add these two functions: edit; and post;

In other words, if your grid is driven from a query, then the following code snippet should take care of the updates to the database:

procedure TForm1.TMSFMXGrid1CellCheckBoxClick(Sender: TObject; ACol,
  ARow: Integer; Cell: TFmxObject);
begin
  qry.Edit;
  qry.Post;
end;

note: this works only for the checkbox column updates when you are in that column. If you are in another column and update that column's data, TMS grid will mess it up due to the way it sorts columns or groups of column. You may have to add the edit; and post; functions in similar events for those columns to update them correctly. I haven't tested it since I only just found that out, like a minute or two ago. Eventually, i'll figure the rest of that out later. For now, I finally have the checbox solved

If all goes well in my larger project, I will update this topic to 'resolved'.
The following user(s) said Thank You: Francisco

Controls inside Grids for Windows, Android and iOS 7 years 3 months ago #1898

unresolved - just when you think you got it, you don't got it.

This fmxgrid is still plagued with the issues I mentioned earlier. I've tested these bugs while inside the IDE and outside as a stand alone exe. This is under the trial version of TMS Pack for Firemonkey. I am using it under my licensed copy of delphi xe7 professional (firedac and mobile add on packs installed).

1. Updating the checkbox (when its not being stubborn about showing the "x") does not update or save to the database. It is still hit and miss with this function! Even with the band aid method (using the edit; and post;) functions mentioned earlier.

2. When clicking the checkbox (and it finally displays the "x") the next columns field to the right of it alters the data inside the cell.

For instance, using Col 1:Row 5 as an example: when I select its checkbox and it fills in the "x", the next cell to the right of it will change the string value from "Line 5" to "Line 7". So, I look at the remaining list of 10 rows to see if the sorting changed the position in that column, and instead, I see that it duplicated Line 7. This is difficult to pinpoint because the new value is not the same in every try. I still believe that this is related to the persistent sorting that I can't turn off nor figure out how to control. With so many options for that, its impossible. I don't understand why the grid needs to resort in the first place, let alone, have no option to control that with an on/off option. This is causing me so much confusion and frustration.

3. And also, the checkbox does not fire on the first click. You have to double click or triple click it to activate it in order for it to show or not show the "x". I have another demo where this is not a problem and that action is done flawlessly in one click. That demo in not connected to a database. I wonder if this is related to when you are connecting (through live bindings) the fmxgrid to a database--any database. There could be a glitch somewhere in there.

And still, I can not believe that none of these problems have been reported to TMS or even Embarcadero. I am not finding any reference to these issues anywhere, so far. I am still trying to figure out this grid component. My boss wants me to keep at it.

Controls inside Grids for Windows, Android and iOS 7 years 3 months ago #1925

I just watched this
www.youtube.com/watch?v=6sMlHH5xlZ8

He managed to modify the control just with some style changes, IDK if it could help to you somehow.
  • Page:
  • 1
  • 2
Moderators: April Anne