Hi~
I created three command buttons in the toolbar. I want to achieve this when I click on the first and second buttons. The third button can be clicked (by default, it cannot be clicked, the icon is gray).
I plan to write code for IsActive () on the third button, but I realize that the IsActive function has already been "initialized" in the beginning. How can I implement this function?
Thanks in advance!
[Solved]command button is clickable under certain conditions
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Solved]command button is clickable under certain conditions
Last edited by xianyu on Tue May 23, 2023 6:22 am, edited 1 time in total.
Freecad novice, A Python enthusiast
-
- Posts: 124
- Joined: Wed Jun 19, 2019 7:44 pm
Re: command button is clickable under certain conditions
You can use the Gui.CommandAction descriptor class.
Here is an example of how you can use it: https://github.com/FreeCAD/FreeCAD/pull/9171
Here is an example of how you can use it: https://github.com/FreeCAD/FreeCAD/pull/9171
Re: command button is clickable under certain conditions
Thank you, marioalexis. I think I found a solutionmarioalexis wrote: ↑Mon May 22, 2023 7:53 pm You can use the Gui.CommandAction descriptor class.
Here is an example of how you can use it: https://github.com/FreeCAD/FreeCAD/pull/9171
Freecad novice, A Python enthusiast