Recent

Author Topic: [Solved] TStringGrid Column set to taRightJustify  (Read 5836 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
[Solved] TStringGrid Column set to taRightJustify
« on: May 04, 2011, 01:42:54 pm »
If you set a TStringGrid Column to taRightJustify, it becomes Left Justified when you edit the cell.  If you then leave the Grid, the cell remains Left Justified.  Is there a way to force it to be Right Justified both when editing the cell and when you leave the Grid?
« Last Edit: May 04, 2011, 02:43:48 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: TStringGrid Column set to taRightJustify
« Reply #1 on: May 04, 2011, 02:06:49 pm »
Quote
If you set a TStringGrid Column to taRightJustify, it becomes Left Justified when you edit the cell.  If you then leave the Grid, the cell remains Left Justified.
I cannot confirm this.  Yes, a text in cell is aligned to left during the editing mode but when I leave it then it become right-aligned as expected.

Lazarus 0.9.31 r30511M FPC 2.5.1 x86_64-linux-qt
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TStringGrid Column set to taRightJustify
« Reply #2 on: May 04, 2011, 02:15:46 pm »
Hey Blaazan, good to hear from you again.  If I move from the Right Aligned cell to another cell in the grid, the Right Aligned cell becomes Right Aligned.  But if I move from the Right Aligned cell to another control, the cell remains Left Aligned.  Maybe this is only under Windows.
Lazarus Trunk / fpc 2.6.2 / Win32

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: TStringGrid Column set to taRightJustify
« Reply #3 on: May 04, 2011, 02:31:51 pm »
Quote
But if I move from the Right Aligned cell to another control, the cell remains Left Aligned.
I was able to reproduce this. The StringGrid must have Options.goAlwaysShowEditor=True . The Cell stays in editing mode and therefore is aligned to left.
See screenshot. On the screenshot the SpinEdit on the right has just focus.
I am not sure if this is a bug. IMO cell should leave editing mode when stringgrid losts focus.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TStringGrid Column set to taRightJustify
« Reply #4 on: May 04, 2011, 02:42:20 pm »
Thanks Blaazan, you solved another problem for me.  Setting Options.goAlwaysShowEditor=False, the cell Right Justifies when I leave the Grid.  I don't know how long it would have taken me to find that on my own. :)  I still wish it could be Right Aligned during Edit, but at least it displays properly in the end.
« Last Edit: May 04, 2011, 02:44:20 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

 

TinyPortal © 2005-2018