How to ctrl dynamic components by ruby code?

For example, click the next menu or toolbar button to change the appearance of the corresponding dynamic components