English 中文(简体)
在TcxGrid的一些行文上为Hiding TcxEditButton
原标题:Hiding TcxEditButton for some rows in a TcxGrid

I have implemented a TcxGrid with some columns. The cells in the last column in this grid contains buttons of type TcxEditButton.

电网的内容要么由用户输入,要么在创建母体时从文字档案中填入。

I would like to hide some of these buttons based on a value in the grid. The value that determines the visibility of the buttons can either be read from the grids memory data set, or directly from a hidden column in the grid.

My problem is that I have not been able to find the correct event to do the check on the value, and set the buttons visibility property. I ve tried to use all sort of events both on the grids table and the column that contains the buttons.

关于如何获取纽芬兰语项目的任何建议,同时在电网被抽出时能够确定这一点?

Solution: Ended up using a modified version if the accepted solution.

procedure TFrame_cx_Element_Inntasting_Kriterier.cxGrid_InntastingDBTVPropertiesGetProperties(
  Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
  var AProperties: TcxCustomEditProperties);
begin
  if ARecord.Values[cxGrid_ColumnWithValidatedValue.Index] = true then
    AProperties := cxEditRepository1ButtonItem1.Properties
  else
    AProperties := cxEditRepository1Label1.Properties;
end;
最佳回答

使用TcxEditButton的“OnGetProperties”栏。

凭记录,可以按照一栏索引获得同一行的另一栏数值。

确定这些财产的最容易的方法是,在TcxEdit 保存地使用两个预先确定的TcxEditButtons,例如,名称为ButtonsVisible和ButtonsInvisible。

本次活动要看这样的情况:

procedure TForm1.cxGrid1TableView1EditButtonColumnGetProperties(
  Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
  var AProperties: TcxCustomEditProperties);
var
  Value: Variant;
  Buttons: TcxEditButtons;
  ButtonEnabled : Boolean;
begin
  if VarIsNull(ARecord.Values[cxGrid1TableView1ColumnToCheck.Index]) then
    AProperties := ButtonsInvisible.Properties; 
    // or AProperties := ButtonsVisible.Properties depending on what you want/need

  Value := ARecord.Values[cxGrid1TableView1ColumnToCheck.Index];
   if (Value = ValueWhenVisible) then
     AProperties := ButtonsVisible.Properties
   else
     AProperties := ButtonsInvisible.Properties;
end;

希望能让你们走上正轨。

问题回答

关于TcxGridDBT的InitEdit活动





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签