Toolbar buttons with submenus

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
leoheck
Veteran
Posts: 1223
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Toolbar buttons with submenus

Post by leoheck »

Is it possible that a Freecad toolbar icon has submenus?
If yes, do you have an example of code?
Last edited by leoheck on Mon Oct 03, 2022 10:22 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Toolbar buttons with submenus

Post by chrisb »

Moved from Developer forum. You post there, if you have questions concerning your own development.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
leoheck
Veteran
Posts: 1223
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Toolbar buttons with submenus

Post by leoheck »

chrisb wrote: Mon Oct 03, 2022 9:54 pm Moved from Developer forum. You post there, if you have questions concerning your own development.
Sorry, I cannot understand.
What does this mean?
This is concerning my own development.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Toolbar buttons with submenus

Post by chrisb »

leoheck wrote: Mon Oct 03, 2022 10:06 pm This is concerning my own development.
Sorry, I thought you asked about configuring your own toolbar. I moved the topic back to Developers.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
leoheck
Veteran
Posts: 1223
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Toolbar buttons with submenus

Post by leoheck »

Oh, that's fine. Thanks, Chrisb.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Toolbar buttons with submenus

Post by Zolko »

leoheck wrote: Mon Oct 03, 2022 9:36 pm Is it possible that a Freecad toolbar icon has submenus?
If yes, do you have an example of code?
if you want a toolbar button that expands down like a menu (not sub-menu) to show more commands then look for dropDownCmd in Asm4_libs. This is what the createFasteners and createDatum buttons do.
try the Assembly4 workbench for FreCAD — tutorials here and here
leoheck
Veteran
Posts: 1223
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Toolbar buttons with submenus

Post by leoheck »

Zolko your exactly the guy I wanted to talk.

My idea was to have a button with menus and submenus.

Why?

Because then Fasteners Workbench could have and option of a Toolbar button with the whole WB inside of it. Then this button could be easily instantiated by other Workbenches like Assembly 4 enabling easy access to all the features.
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Toolbar buttons with submenus

Post by ebrahim raeyat »

maybe this can be helpful, Group command:

https://github.com/ebrahimraeyat/civilT ... ns.py#L124
leoheck
Veteran
Posts: 1223
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Toolbar buttons with submenus

Post by leoheck »

Thanks Ebrahim. Is this a Freecad workbench that I can test? I could not find it with the package manager.

Edit: I installed it manually. I am seeing 2 toolbar buttons with dropdown lists (Load Combination, and Frame Section). But they don't have sublists (nested lists).
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Toolbar buttons with submenus

Post by ebrahim raeyat »

leoheck wrote: Sat Oct 08, 2022 2:30 am
Edit: I installed it manually. I am seeing 2 toolbar buttons with dropdown lists (Load Combination, and Frame Section). But they don't have sublists (nested lists).
I don't know if it is possible to create nested lists with this manner. you can test it. Let me know if it is possible.
Post Reply