简体   繁体   English

覆盖 displayOption 以根据 displayMethod 中的值为某些行着色

[英]overriding displayOption to color certain lines according to a value from displayMethod

I am trying to override the displayOption on my form so that I color certain lines following certain conditions, When my condition was related to a normal field I had no problem with that, example code:我试图覆盖表单上的displayOption以便我按照某些条件为某些行着色,当我的条件与普通字段相关时,我对此没有问题,示例代码:

public void displayOption(Common _record, FormRowDisplayOption _options)
{
 if (_record.(fieldnum(MY_Table,My_Field))=="YES")
 {
  _options.backColor(WinAPI::RGB2int(161,161,255));
 }
  super(_record, _options);
}

but my problem is, I want to make a condition on a displayMethod not a normal field但我的问题是,我想在 displayMethod 上设置条件而不是普通字段

A display method will work, you just need to cast the Common _record to your table buffer, then you can access the table method.一个显示方法将起作用,您只需要将Common _record到您的表缓冲区,然后您就可以访问该表方法。

So if it was SalesTable , you would create:因此,如果它是SalesTable ,您将创建:

SalesTable      salesTable;

salesTable = _record as SalesTable;
if (salesTable.yourTableDisplayMethod == "whatever") { // Do something }

Then you can use the display method as normal.然后就可以正常使用显示方法了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM