Call button's OnClicked from another inputs OnFieldChanged in Configurator

Is there a way to call the OnClicked of a button, from within the OnFieldChanged of other inputs?
Or to possibly make a “global” function, that can be called from an inputs events?

Background: I have a button to “re-calc” the part number and description (which has a very lengthy expression), when clicked.

I’d like that to happen every time any input is changed.

I could put that expression in the On Field Changed for every control, but that ends up being a pain to maintain, as any changes to the expression require updating every single input.

You can make the function it’s own method and just call the method whenever you want to do the calculation.

private void yourmethodhere(some parameters if you want)
        {
           do stuff here
        }

Then whenever you want to call it, just use

yourmethodhere();

If you look at this old thread about writing CSV’s you can see the method addDataToCSV that is called from other places in the code. Then you can use it whenever you want, but only have to maintain it in one place.

And where do I put the function definition? In the configurator’s OnLoad?

in the script at the bottom. You only call it when you need it. You don’t need it on load.

EDIT Is this for configurator??? I take everything back. I think configurator is different. I was thinking customization.

I know that you can save custom methods though. It was in extended ed last year. Let me dig out my book.

I’m talking about the Configurator designer and not a customization.

and while playing around, I think the following might work

Refresh.Events("btnRecalcClicked");
1 Like

Nope … That don’t work. It passes syntax check but doesn’t cause the On Clicked code of btnRecalc to execute.

Yeah, so you can make a UDMethod. You need to go to User Defined Methods Entry. (That’s what it says in the book)

Here it is. You can make your method here, then call it when you want in the configurator.

Then when you use it in the configurator, it’s UDMethods.YourMethodName();

1 Like

Thanks. Got it working.

(such big changes in the Configurator from V8 to E10)

2 Likes