Recent

Author Topic: Multiline cell editor  (Read 12293 times)

straetch

  • Jr. Member
  • **
  • Posts: 75
Re: Multiline cell editor
« Reply #15 on: May 18, 2017, 09:05:14 pm »
Quote
I found a bug in the column count calculation if the grid's AutoExpand flags do not contain the flag aeDefault. I hope the fix has no sideeffects because I had to touch this location already several times...
Tested with r5861.

Quote
But BTW, the flag aeDefault is not needed in your case anyway. It is needed when loading files that occupy only a few cells and you want the grid to expand to get a "spreadsheet" look & feel. In your case, setting the ColCount should be enough.
Actually the demo was derived from a case where the WorksheetGrid was intended as a TStringGrid alternative (therefore the ShowHeaders = false). So, the - [aeDefault] is relevant here.
This thread is becoming complicated. The CellEdit was introduced in the demo before you released the multiline grid cell editor. In my application I removed the CellEdit, so now I can re-insert the  "AutoExpand := AutoExpand - [aeDefault]" statement (I think).
In the later demo I left the CellEdit in because it demonstrates a problem.

The internals of fpspreadsheet and underlying layers are encapsulated for me as an applications programmer - lucky for me and others.
But it seems that we try to have one implementation that should satisfy two conflicting cases: the WorksheetGrid as close as possible to an Excel worksheet, and the WorksheetGrid as a superior dedicated TStringGrid. Just an idea: could it be simpler to make two seperate classes: a WorksheetGrid (first case) and a "WorksheetStringGrid"?

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Multiline cell editor
« Reply #16 on: May 18, 2017, 10:03:53 pm »
But it seems that we try to have one implementation that should satisfy two conflicting cases: the WorksheetGrid as close as possible to an Excel worksheet, and the WorksheetGrid as a superior dedicated TStringGrid. Just an idea: could it be simpler to make two seperate classes: a WorksheetGrid (first case) and a "WorksheetStringGrid"?
It's not only the grids, it would also be the worksheet which must be separated. The reason why I am still hesitant to make the WorksheetGrid to Super-StringGrid is that it is based on the spreadsheet infrastructure. The convenience to merge cells, to draw cell borders, or to draw text vertically pulls a lot of code into the grid which is not necessary in this context: a formula parser and lots of related code, a number format parser, readers and writers for several spreadsheet formats, etc. Is this worth it? I posted several sample projects in the examples/gridexamples folderof the Lazarus installation which demonstrate how the standard TStringGrid can be extended for cell merging or text overflow. Or if you want it even simpler: Why don't you try kgrid (http://www.tkweb.eu/en/delphicomp/kgrid.html)?
« Last Edit: May 18, 2017, 10:59:23 pm by wp »

straetch

  • Jr. Member
  • **
  • Posts: 75
Re: Multiline cell editor
« Reply #17 on: May 21, 2017, 01:07:00 pm »
Quote
I posted several sample projects in the examples/gridexamples folderof the Lazarus installation which demonstrate how the standard TStringGrid can be extended for cell merging or text overflow. Or if you want it even simpler: Why don't you try kgrid (http://www.tkweb.eu/en/delphicomp/kgrid.html)?
This is how I started. I was looking for a more powerful stringgrid than the standard one. On several fora there are complaints about TStringGrid. Many of the suggestions advocate the use of WorksheetGrid with fpspreadsheet. Since I was already successfully using fpspreadsheet, that's what I did.
I never understood why there was never a development towards a more powerful TStringGrid in lcl.
I tried kgrid already several years ago because the promo claims a versatile component that adresses all my requirements. But I gave up. The major reason is that the api documentation is not available in the download nor the website - only a "manual" that explains a few cases in a rather cryptic manner. The demo, supplied with kgrid, is not sufficient. It is a real pity.
First thing now: I'll have a second look into examples/gridexamples.

straetch

  • Jr. Member
  • **
  • Posts: 75
Re: Multiline cell editor
« Reply #18 on: May 21, 2017, 02:10:37 pm »
I have to correct myself on kgrid. Although there is no evolution of kgrid since 2010, I downloaded kcontrols again. KControls.chm is present.


 

TinyPortal © 2005-2018