Program in own layout & as related program in another layout

I have a program which is used in an own layout. Also I need this program as a related child in another layout. For that I use a relation head_to_child_by_number. The program has a field for the number. This field should be editable if I use the program in an own layout, but the field should not editable if I use the program as a related child in another layout, because this is the head to child matching number. So I do in the head program, the following in updateUI:

function updateUI( _mode, _toolbarForm, _forceModeChange ) {
	_super.updateUI( _mode, _toolbarForm, _forceModeChange );
	
	forms[ 'formName' ].elements[ 'fld_number' ].editable = false;
	
	return
}

I realized, if I do that and I have at the same time also the program open in which the form is used too, the field there is also not editable.

How can I have the field not editable if the program is a related child and how can I have the field editable if the program itself is the head in an own layout?

Hi,

In the method you could set a if based on what layout you are on.

Regards Sanneke

sanneke:
Hi,

In the method you could set a if based on what layout you are on.

Regards Sanneke

Hi, is there a function to get the layout? If I switch between layouts, updateUI is not called, is that correct?

This seems to work.:

function updateUI( _mode, _toolbarForm, _forceModeChange ) {
	
	var layout = '',
		/** @type {UUID} */
		layoutId = '';
	
	layoutId = globals.nav_layout_id;
	layout = globals.svy_nav_getLayoutForm( layoutId );
	
	
	_super.updateUI( _mode, _toolbarForm, _forceModeChange );
	
	if ( layout.match( 'Flottenverwaltung' ) ) {
		forms[ 'br_boss_fleet_fleetAccounts_dtl' ].elements[ 'fld_vessel_no' ].editable = false;
	} else if ( layout.match( 'Fleet_Accounts' ) ) {
		forms[ 'br_boss_fleet_fleetAccounts_dtl' ].elements[ 'fld_vessel_no' ].editable = true;
	}
	
	return
}