Trigger the click event of the button by another button

Here I have a button in bottom as Dock.
By using that button I need to trigger the click event of the above Button - 1.
Please suggest some Idea..
--NOTE : here the button was inside the column container , but in another view it may in Tab container or outside of the container.
Thanks in advance

Generally you cannot. Move the logic to a project script function and call that from both buttons.


:worried: the button in the bottom of the view as docked but the above button-1 may differ as I mentioned in the NOTE ..EX : I may have a 397+ views

Why does that matter? @pturmel's suggestion would still work. The only reason to call another components event is to execute the code that would be executed by that event.

If instead you abstract that code to a project script function which both components can reach, then they can both execute the same code with out knowing about each other. Doesn't matter if there are two components or 397+ components.

1 Like

Move your logic into focusGained.
Then send a perspective message and trigger it with self.focus()

How do you prevent the code from executing when the focus is gained unintentionally?

you can't

My guess is a big coupling of the GUI and business logic

  1. Is it possible to find the component path.

EX : let's consider the button 1 as in the name of " btn_save". by writing any scripting by python to find the path of the component is it possible..

Will the button always be on the screen or not?

Ifso then i guess in theory you could look for it with js. But its terrible practice tbh

Well i guess if you like want the save button to be able to "float" on every page without having to scroll down... it wouldnt be to bad.

You'll have to give every button a domId in the metadata with the same name (btn_Save)
and be sure there will never be multiple on the same screen (else it might trigger the wrong one)

i'll get you the js script a bit later

Is there any reason you wouldn't just do what Phil suggested ?
What problem are you trying to solve ?

1 Like

What Phil suggested would work.

Also, it seems like a message handler would work (assuming you are using Perspective). Here is a link to the documentation:


yes i'm using perspective

I'm guessing that it may not make sense to put such niche code into a project script in this instance.

For something like this, I would be calling system.perspective.sendMessage on your dock button to trigger a message handler on the content View button, like @j.israelsen mentioned.