Recent

Author Topic: fpspreadsheet draw event question  (Read 3762 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
fpspreadsheet draw event question
« on: December 07, 2016, 12:19:55 pm »
Hello, how do I ensure that the selection of a cell in a grid (fpspreadsheet) already populated not trigger me DrawCell event? I do not want to see the margins and do not want to draw it, I just want to

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: fpspreadsheet draw event question
« Reply #1 on: December 07, 2016, 01:30:52 pm »
If you want to hide the border of the selection rectangle then set the SelectionPen.Style of the grid to psClear. (But I think that this is not a good idea...).

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: fpspreadsheet draw event question
« Reply #2 on: December 07, 2016, 03:50:57 pm »
I'll explain my reason. I would like to let the board to the selected cell! But the selection on my project slows me a lot what happens in the event double click. I attach timelines to make you understand.

[SelectCell-4,6-: 0 ] time execution: 1618 ms
[SelectCell-4,6-: 0 ] time execution: 1076 ms
[DblClick-4,6-: 1 ] time execution: 706 ms

What you need to me it is to reduce the time taken by select_cell that in case of double click is invoked 2 times.

My need is to run the double click (via a select cell event only) and if you can not redraw the contents of the grid. As in my case it should not redesign anything that is not already drawn. If we can only have the design of the edge of the cell selected is fine but without always redraw the entire grid.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: fpspreadsheet draw event question
« Reply #3 on: December 07, 2016, 04:47:57 pm »
Sorry, I don't understand. Please post a project in which a select cell takes 1.5 s, I can't believe it.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: fpspreadsheet draw event question
« Reply #4 on: December 08, 2016, 10:42:41 am »
Look, Forget, I handled the event from the mouse Taking a break event to select. Me it managed So it works. Another thing I just wanted to ask you. Come I make a bold Put the Contents Of A Cell Already valued?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: fpspreadsheet draw event question
« Reply #5 on: December 08, 2016, 11:34:07 am »
I am sorry and don't want to criticize you language skills, but I don't understand a single word. Maybe you should post your question in your native language and maybe somebody else can translate if for me.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: fpspreadsheet draw event question
« Reply #6 on: December 08, 2016, 11:56:22 am »
No problem. (italian mode)

Ho risolto gestendomi da solo l'evento. Ho messo abort nella selezione della cella e ho gestito l'evento mouse down.

Ora funziona. L'unica cosa che volevo ancora sapere è: come faccio a trasformare il contenuto di una cella già valorizzata in grassetto?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: fpspreadsheet draw event question
« Reply #7 on: December 08, 2016, 03:55:41 pm »
Combining Google translate and my little vacationer's Italian knowledge: You want to format a cell in bold?

In the worksheet: Use TsWorksheet.WriteFontStyle(ARow, ACol, AStyle) where AStyle is a set of fssBold, fssItalic, fssUnderline and fssStrikeout (note the additional s in the prefix to distinguish from the font styles of the graphics units which are not supported in the basic package):
Code: Pascal  [Select][+][-]
  1.   MyWorksheet.WriteFontStyle(ARow, ACol, [fssBold]); // <-- make bold
  2.   MyWorksheet.WriteFontStyle(ARow, ACol, []);        // <-- remove bold from a cell

Or, if you prefer the grid, use the grid property CellFontStyles[]:
Code: Pascal  [Select][+][-]
  1.   sWorksheetGrid.CellFontStyles[ARow, ACol] := [fssBold];  // <-- make bold
  2.   sWorksheetGrid.CellFontStyles[ARow, ACol] := [];         // <-- remove bold

See the grid's wiki article: http://wiki.lazarus.freepascal.org/TsWorksheetGrid#Cell_formatting
« Last Edit: December 08, 2016, 03:57:29 pm by wp »

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: fpspreadsheet draw event question
« Reply #8 on: December 08, 2016, 08:00:29 pm »
Thank you  ;D
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018