Expand my Community achievements bar.

SOLVED

Change bottonInset on a subform

Avatar

Level 2

Hi

I'm having difficulties on changing SubformB.margin.bottomInset.

On SubformB::calculate I have this script:

if(this.SubformA.instanceManager.count == 1){

  this.margin.bottomInset = "3.2mm";

}

else{

  this.margin.bottomInset = "0mm";

}

console.println("** bottom: " + this.margin.bottomInset);

While I can see the println, with the correct values, the bottom margin doesn't change visually.

Any help on this?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Should be as simple as that, your form would have to be dynamic and your subform in a flowed container, but I assume it is if you are playing with the instanceManager.

Can you share your form?

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Should be as simple as that, your form would have to be dynamic and your subform in a flowed container, but I assume it is if you are playing with the instanceManager.

Can you share your form?

Avatar

Level 10

You'll have to force the calculate script to execute to see the desired effect.

Given you have a subform "SF" with a nested subform "SubformA" in it. You'll need two things:

A) A script in the calculate event of "SF"

// Script to set instances of subform "SubformA". Replace with you own script if neccessary!

_SubformA.setInstances(this.rawValue);
// scriot to execute the calculate script of subform "SF"

SF.execCalculate();

B) A script to add/remove instances of SubformA and triggering the calculation script in "SF".

this.margin.bottomInset = this._SubformA.count === 1 ? "3.2mm" : "0mm";