Warm tip: This article is reproduced from serverfault.com, please click

overriding displayOption to color certain lines according to a value from displayMethod

发布于 2021-07-12 12:56:20

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:

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

Questioner
YOUSFI Mohamed Walid
Viewed
0
Alex Kwitny 2021-07-14 02:15:51

A display method will work, you just need to cast the Common _record to your table buffer, then you can access the table method.

So if it was SalesTable, you would create:

SalesTable      salesTable;

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

Then you can use the display method as normal.