Jump to content


Photo

[5.0] How to draw column "grey"?


  • Please log in to reply
5 replies to this topic

#1 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 07 September 2009 - 04:03 PM

Hello

Until now, I used "Columns[0].DrawingOptions := doCustomOnly;" and the corresponding routine to make a whole column look fixed (ie. grey), but I was wondering if I could simplify the code by using the following code:

CODE
FixedCols := 1;
Columns[0].ColumnStyle := ???


Besides the appearance, since this column is 100% read-only, the column should be unselectable ,ie. the user shouldn't be able to navigate to this column through either the keyboard arrow keys or mouse clicks. Is it possible to forbid this through code?

Thank you.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 08 September 2009 - 02:06 AM

Hello Fred,

Maybe Enabled property of Column can help?

Best regards
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 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 08 September 2009 - 08:38 AM

You can use the column's color property to set the fixed column colour.

CODE
FixedCols := 1;
Columns[0].Enabled := False;
Columns[0].Color := clSilver;


#4 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 08 September 2009 - 10:55 AM

Thanks guys for the tip.

CODE
Columns.Add(TNxTextColumn,'Key');
Columns[0].Name := 'key';
Columns[0].Enabled := False;
//clSilver, clGray, clLtGray, clBackground
Columns[0].Color := clBtnFace;

Columns.Add(TNxTextColumn,'Value');
Columns[1].Name := 'value';

FixedCols := 1;


BTW, what is the purpose of FixedCols, really? When I change the above to "2", it makes no graphical difference, the "Value" column is still displayed as before and I can navigate up/down using the arrow keys.

#5 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 08 September 2009 - 01:00 PM

FixedCols is only relavant if the number of columns in the grid exceeds the visible width of the grid (i.e. if the horizontal scrollbar is visible). When scrolling to the right to see the columns that don't fit, the FixedCols on the left of the grid will NOT scroll and will always be visible.

#6 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 08 September 2009 - 04:15 PM

I see. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users