I am defining a schematic bindkey to iteratively toggle through visibility of a few label options in the schematic view.
Ideally, the bindkey could test label visibility prior to toggling, so one of the iterations is effectively a view all (on) setting.
Two of the label types can be toggled through the View menu callbacks - Instance and Terminal labels.
I would like to then use the menu text to determine the current label settings.
However, the text items of the View menu -
do not get updated when using the menu callbacks - not until a mouse click on the View menu.
This causes the bindkey (SKILL) to have incorrect values.
will both toggle terminal label visibility. But afterward,
Is there a way to force the View Menu items to update when using SKILL to execute the menu callback items?
Why is this?
The reason is that there's a menu posting callback which updates the text of the menu when the menu is raised (see the <ICinstDir>/tools/dfII/etc/tools/menus/schView.menus file - the function is _schViewMenuCB).
Unfortunately all of these functions - the menu action and the menu posting callback are private, so buyer beware - they may change. In practice they actually check for the visibility of the appropriate layer-purpose(s) in the tech file and use that to determine the current state. The function to facilitate all of that is also private (although you could use the appropriate layer purpose pairs to detect that):
instLabels: device/annotate and annotate/drawingnotes: text/drawing and text/drawing1termLabels: annotate/drawing8parasiticNotes: annotate/drawing4
tf=techGetTechFile(geGetEditCellView())status=forall(lpp list(list("device" "annotate") list("annotate" "drawing")) techGetLP(tf lpp)~>visible)
Then status would tell you the info as to whether the appropriate layers are all visible or not (and you could give the appropriate list depending on which type of labels you're checking).
The alternative would be to just call _schViewMenuCB(schViewMenu hiGetCurrentWindow()) to update the menu text - i.e. do what the menu posting callback would do - and then check the item text (I don't like this approach though as it means you're calling a private function). However, since the action is also private, _schHiToggleLabels is also private, not sure what's worse...
Thank you Andrew, that works!
Thank you for the insights also - invaluably helpful!