Jump to content


Photo

Setting "taCenter" as Alignment of the column causes an error.

taCenter Alignment TNxTextAlign Delphi2007

  • Please log in to reply
9 replies to this topic

#1 cuefejen

cuefejen
  • Members
  • 9 posts
  • Gender:Male
  • Location:Japan

Posted 15 February 2018 - 05:23 PM

Hello Friends,
 
I wanted to set "taCenter" to Alignment in the checkbox column of NextGrid6.
In the [uses] section, Classes, NxTypes6 are written in this order.
 
The compile error source code is this.
NextGrid61.Columns [1] .Alignment: = taCenter;
 
Error message:
E2010 TAlignment and TNxTextAlign are not compatible.
 
The following code will not result in an error.
NextGrid61.Columns [1] .Alignment: = taLeftJustify;
NextGrid61.Columns [1] .Alignment: = taRightJustify;
 
 
Operating environment:  NextGrid6 ver.6.1.0  and  Delphi2007
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, NxGridView6, NxColumns6, NxControls6, NxCustomGrid6, NxVirtualGrid6,
  NxGrid6, NxTypes6;

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxIncrementColumn61: TNxIncrementColumn6;
    NxCheckBoxColumn61: TNxCheckBoxColumn6;
    NxTextColumn61: TNxTextColumn6;
    NxReportGridView61: TNxReportGridView6;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin    
  NxIncrementColumn61.Header.Caption := 'No';
  NxCheckBoxColumn61.Header.Caption := 'Select';
  NxTextColumn61.Header.Caption := 'String';
  with NextGrid61 do begin
    Caption := '';
    SelectionColor := $0097E4FB;
    AlternatingRowColor := $00EDF5E9;
    AppearanceOptions := AppearanceOptions + [aoAlternatingRowColors];
    Columns[0].Alignment := taRightJustify;
    Columns[1].Alignment := taCenter;  // error
//    Columns[1].Alignment := TAlignment(2);
    Columns[2].Alignment := taLeftJustify;
    AddRow(10);
  end;
end;

end.

 
I tried exploring the cause.
"taCenter" is declared with both TAlignment and TNxTextAlign.
 
Can I change "taCenter" of TNxTextAlign?
 
Thank you.


#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 15 February 2018 - 08:08 PM

Hi,

You can use Classes.taCenter together and it should work.

Hope it helps.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 cuefejen

cuefejen
  • Members
  • 9 posts
  • Gender:Male
  • Location:Japan

Posted 16 February 2018 - 05:41 AM

Hi Boki,

 

Thank you for your immediate reply.

 

I have manually added NxTypes6 to the [uses] section. 

Because for "aoAlternatingRowColors" of AppearanceOptions.

 

In the source code of Form 1 shown previously, a compile error actually occurs.

 

Where is it wrong?

 

Thank you.



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 16 February 2018 - 09:10 PM

Hi,

Did you maybe tried to write Columns[1].Alignment := Classes.taCenter;
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 cuefejen

cuefejen
  • Members
  • 9 posts
  • Gender:Male
  • Location:Japan

Posted 17 February 2018 - 06:18 AM

Hi Boki,

 

I did not notice the method.

 

Thanks to you, I solved it well.

 

and
 
Because I used the google translation service, it was incomplete.
Please pardon.


#6 Jacek

Jacek
  • Members
  • 3 posts

Posted 16 February 2019 - 01:16 PM

Hi

I have the same problem II makes a error using taCenter.

I try to use =Classes.taCenter; but it gives me an error that not defined,.

Any idea.?



#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 16 February 2019 - 01:57 PM

Hi,

You can try with NxTypes6.taCenter. It can depends from Delphi versions.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 Jacek

Jacek
  • Members
  • 3 posts

Posted 16 February 2019 - 06:00 PM

HI

The same

[dcc32 Error] E2010 Incompatible types: 'TAlignment' and 'TNxTextAlign'

 

My Delphi is XE 10 Tokyo

 

 



#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 16 February 2019 - 06:05 PM

Hi,

Can you then try to use TAlignment.taCenter. Hope this will work
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#10 Jacek

Jacek
  • Members
  • 3 posts

Posted 16 February 2019 - 06:11 PM

Hi

Solved, it must be

 

system.Classes.taCenter;

 

Topic closed.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users