Recent

Author Topic: TsCellCombobox doesn't show font size.  (Read 8121 times)

Soner

  • Sr. Member
  • ****
  • Posts: 305
TsCellCombobox doesn't show font size.
« on: August 14, 2018, 11:52:29 am »
When the font size not exist in combobox-list then, then it doesn't show it.
here is how to fix it:

Code: Pascal  [Select][+][-]
  1. // fpspreadsheetctrols.pas
  2. // Add only the line with comment  at the end.
  3. procedure TsCellCombobox.ExtractFromCell(ARow, ACol: Cardinal);
  4. //...
  5.     cfiFontSize:
  6.       begin
  7.         fnt := Worksheet.ReadCellFont(cell);
  8.         ItemIndex := Items.IndexOf(Format('%.0f', [fnt.Size]));
  9.         if ItemIndex<0 then Text:=fnt.Size.ToString; //soner add this line
  10.       end;
  11.  

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: TsCellCombobox doesn't show font size.
« Reply #1 on: August 14, 2018, 05:28:25 pm »
Fixed in ccr-r6602. Applied the same to the other values of TsCellCombobox.FormatItem.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: TsCellCombobox doesn't show font size.
« Reply #2 on: August 16, 2018, 08:55:54 am »
@wp
Thanks.

Can you make this changes too?
It's for number column width, first left column with numbers.
The TsCustomWorksheetGrid.GetDefaultHeaderColWidth exist already, but it must changed and others are new.
Code: Pascal  [Select][+][-]
  1. fpspreadsheetgrid.pas
  2.  
  3.   TsCustomWorksheetGrid = class(TCustomDrawGrid, IsSpreadsheetControl)
  4.   private
  5.     { Private declarations }
  6.     fDefaultHeaderColWidth: Integer;
  7.   public
  8.     property DefaultHeaderColWidth: Integer read GetDefaultHeaderColWidth write SetDefaultHeaderColWidth default 0;
  9.   end;
  10.   TsWorksheetGrid = class(TsCustomWorksheetGrid)
  11.   published
  12.     property DefaultHeaderColWidth;
  13.   end;
  14.  
  15. function TsCustomWorksheetGrid.GetDefaultHeaderColWidth: Integer;
  16. begin
  17.   if fDefaultHeaderColWidth=0 then Result := Canvas.TextWidth(' 9999999 ')
  18.   else Result := fDefaultHeaderColWidth;
  19. end;
  20.  
  21. procedure TsCustomWorksheetGrid.SetDefaultHeaderColWidth(const AValue: Integer);
  22. begin
  23.   if fDefaultHeaderColWidth=AValue then exit;
  24.   fDefaultHeaderColWidth:=AValue;
  25.   //Setup;  //<-- Shall we call it? GetDefaultHeaderColWidth is used only in Setup;
  26. end;
  27.  


Can we change this two things?
1)Wenn you press [delete]-key in a cell then then this deletes the cell completly, borders, font properties... Can we delete only the content number, text or formula like in other spreadsheet applications?
[ctrl] or[shift] + [delete] can delete completely.
2)Wenn you press in merged cells right key you cannot select the cells on the right side. It sould selectable.
I will check how we can do this two issues today afternoon.





wp

  • Hero Member
  • *****
  • Posts: 11830
Re: TsCellCombobox doesn't show font size.
« Reply #3 on: August 16, 2018, 09:33:55 am »
Can you make this changes too?
It's for number column width, first left column with numbers.
The TsCustomWorksheetGrid.GetDefaultHeaderColWidth exist already, but it must changed and others are new.
Done in r6603. Renamed it to FixedColWidth.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: TsCellCombobox doesn't show font size.
« Reply #4 on: August 16, 2018, 03:51:45 pm »
1)Wenn you press [delete]-key in a cell then then this deletes the cell completly, borders, font properties... Can we delete only the content number, text or formula like in other spreadsheet applications?
[ctrl] or[shift] + [delete] can delete completely.
Done in ccr-r6605. The old behavior (delete everything) is accessible with CTRL+DEL.

2)Wenn you press in merged cells right key you cannot select the cells on the right side. It sould selectable.
If you mean to select a cell which now belongs to the merged block: no, this is not intended. That's why they are merged. Being able to select sub-cells of the block would be very confusing because the content and format of the entire block is determined by the top-left cell only. Whatever would be done with the other cells of the block would not be visible.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: TsCellCombobox doesn't show font size.
« Reply #5 on: August 16, 2018, 07:51:18 pm »
Thanks.

2)Wenn you press in merged cells right key you cannot select the cells on the right side. It sould selectable.
If you mean to select a cell which now belongs to the merged block: no, this is not intended. That's why they are merged. Being able to select sub-cells of the block would be very confusing because the content and format of the entire block is determined by the top-left cell only. Whatever would be done with the other cells of the block would not be visible.
I don't mean that. I mean the first row or column after merged cells.
In example:
1. Merge cells from B2 to C3 (2 Rows and 2 Columns)
2. Select Merged cell
4. Now press right-key. D2 should be selected but it doesn't.
 You can press right-key as often as you want, it will not work.
4. Now press down-key twice. B5 is selected.
 You must press down/up key as often as merged row count, to exit merged cells.

I think you must press left/right/up/down-key once to select first cell before or after merged cells.

I looked at code and could not detect where you prevent in horizontal direction. I wanted also correct the false selection in vertical direction.
The best thing is to hold the old selected row or col (before entering in merged cell) in a variable. In example from above when you come from c1 to merged cell (b2:c3) you should exit merged cell to c4 not in b4. (exit to b4 is current behavior).
« Last Edit: August 16, 2018, 07:53:39 pm by Soner »

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: TsCellCombobox doesn't show font size.
« Reply #6 on: August 16, 2018, 08:05:29 pm »
Maybe you did the keyboard navigation ialready here:
Code: Pascal  [Select][+][-]
  1. {$IF LCL_FullVersion >= 1090000}
  2. function TsCustomWorksheetGrid.MoveNextSelectable(Relative: Boolean; DCol, DRow: Integer
  3.   ): Boolean;
  4. var
  5.   cell: PCell;
  6.   r1, r2, c1, c2: Cardinal;
  7. begin
  8.   if Relative then begin
  9.     cell := Worksheet.FindCell(GetWorksheetRow(Row), GetWorksheetCol(Col));
  10.     if Worksheet.IsMerged(cell) then begin
  11.       Worksheet.FindMergedRange(cell, r1,c1,r2,c2);
  12.       // we are only interested on relative movement (basically by keyboard)
  13.       if DCol>0 then DCol := GetGridCol(c2) - Col + 1 else
  14.       if DCol<0 then DCol := GetGridCol(c1) - Col - 1 else
  15.       if DRow>0 then DRow := GetGridRow(r2) - Row + 1 else
  16.       if DRow<0 then DRow := GetGridRow(r1) - Row - 1;
  17.     end;
  18.   end;
  19.   Result := inherited MoveNextSelectable(Relative, DCol, DRow);
  20. end;
  21. {$ENDIF}
  22.  

I will download the lazarus svn version tomorrow.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: TsCellCombobox doesn't show font size.
« Reply #7 on: August 16, 2018, 08:05:46 pm »
If you use the current Lazarus trunk you will find a different behavior because I applied some code by which Jesus Reyes had fixed a similar bug in the merged_cells demo (in (lazarus)/examples/gridexamples/merged_cells); in this fix, the method MoveNextSelectable of TCustomGrid must be virtual - and this is why you need the latest trunk.

It is still not quite correct because arrow-keying through a merged block may jump to a different column after the block. Unfortunately I cannot focus on this issue at the moment. Maybe you try to find the bug yourself, or wait a bit. (But as I said you'll need Laz-trunk).

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: TsCellCombobox doesn't show font size.
« Reply #8 on: August 16, 2018, 08:10:44 pm »
If you use the current Lazarus trunk you will find a different behavior because I applied some code by which Jesus Reyes had fixed a similar bug in the merged_cells demo (in (lazarus)/examples/gridexamples/merged_cells); in this fix, the method MoveNextSelectable of TCustomGrid must be virtual - and this is why you need the latest trunk.

It is still not quite correct because arrow-keying through a merged block may jump to a different column after the block. Unfortunately I cannot focus on this issue at the moment. Maybe you try to find the bug yourself, or wait a bit. (But as I said you'll need Laz-trunk).
Thanks, I found it at least. We posted it in same time. This issue is not important. I can wait up to next release or fix it self.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: TsCellCombobox doesn't show font size.
« Reply #9 on: August 16, 2018, 08:18:19 pm »
I did it for the current lazarus version. It works good.
If someone want it, here is what to do for the current lazarus version:
Code: Pascal  [Select][+][-]
  1. //----------- Grids.pas
  2. TCustomGrid=class(TCustomControl)
  3.   //...
  4.   function  MoveNextSelectable(Relative:Boolean; DCol, DRow: Integer): Boolean; virtual; //add at end virtual
  5.  //..
  6. end;
  7.  
  8. //----------- fpspreadsheetgrid.pas
  9. TsCustomWorksheetGrid = class
  10.  //...
  11.    //comment out this condition {.$IF LCL_FullVersion >= 1090000}
  12.     function  MoveNextSelectable(Relative: Boolean; DCol, DRow: Integer): Boolean; override;
  13.     //comment out this condition  {.$ENDIF}
  14.  
  15.    //comment out the same conditions in implementation part.
  16.  
  17.  
  18.  

 

TinyPortal © 2005-2018