This is a pretty easy mod to do. Just follow the steps below. I'm using the example of hiding the field but you can just disable/enable the field from editing if you want using the allowEdit() property.
Your situation may be more complicated but this is meant to be a simple example.
- Set the target form control's 'AutoDeclaration' property to 'yes'. by default it should be false
- For the primary record (e.g. in the grid), override the datasource's active() override if it is not already.
- After the super(), put the form control name in with the visible property. If you hit the period after the form control name and nothing pops up, 1) make sure the form control is spelled correctly and 2) check step 1 again to make sure the control has its autoDec set to yes.
- If the conditionals for the field to show up are complex, you might have logic and the visible property just assigning true/false, yes/no, etc outright. Example: FormControl_FieldName.visible(true);
- If the conditional is simple, like seeing if a field is a boolean or a type of a base enum, you can put the conditional statement in the parameters Example: FormControl_FieldName.visible(DSTableName.BaseEnumField == BaseEnum::Value2);
Test your logic. Its pretty common people will have a field or button default a property to true/false, not not change the field again when moving to a new record. That means that the control will not have the value you want
Enjoy!
excellent
ReplyDelete