Form edit mode disable also pencil on fields

Managed to set the Purchase order table form to disable edit mode. Disabling the button so that one cannot set the form into edit mode. However this is done, I cannot remove the pencil/pen icon on the fields. This will put the whole form into edit mode.

In the screenshot below, notice that the edit button is disabled, but the edit icon on every field is enabled putting the whole form into edit mode upon pressing it. Anybody know how to disable this?

Just to mention it, these are the things I’ve tried:

  1. extended class PurchTableType and added funcitonality

boolean canPurchaseOrderBeUpdated()
{
boolean ok = true;

PurchTable purchTable = this.parmPurchTable();
FormDataSource formDataSource = FormDataUtil::getFormDataSource(purchTable);

ok = next canPurchaseOrderBeUpdated();

if ( formDataSource
&& !PurchTable_BAMA::readOnlyCheckForPSYS(purchTable)) // Your custom field
{
ok = false;
//warning(‘read only’);
}
else
{
//info(‘writeable’);
ok = true;
}

return ok;
}

  1. Various attempts in adding post event handlers to form and table events.

These attempts have been successfull in hindering the user to edit, but still not able to remove/disable the little pen/pencil icon setting the form in edit mode.