10-16-2023 03:14 AM
Hi,
I'd like to create a popupmenu which reacts only on free lables (aka: comments). While I was testing my new menu I realized that my menu item shows up not just for comments but also for string constants and string controls. Is there a way to make a popupmenu working only on comments?
(the affected items typedef is set to: Generic/GObject/Decoration/Text/Text)
Thanks.
Solved! Go to Solution.
10-16-2023 03:35 AM - edited 10-16-2023 03:46 AM
I haven't found a direct way to get this from the reference. AFAIK, you have to do this indirectly...
1) Traverse the BD and FP for Text objects, and for each item in your array check if it's in the results.
2) Or, for each item, get the owner (it's diagram or pane), get the diagram\pane's decorations, and check the list:
1) might be slower for small arrays on big diagrams, 2) might be slower on larger arrays...
EDIT: It appears that labels of controls have their control as owner, while controlterminals have the diagram as owner. So, for each object, get the owner, if it's a diagram get it's decorations and check if it's in a list. If the owner is a control, it's obviously not a free label...
10-16-2023 03:45 AM
This will work, thanks!