MenuNodeGetProperty(hNode, iField) - Possible bug or mismatch with Help File?

Hi,

I'm getting some return values that do not match what's stated in the help file for Function : MenuNodeGetProperty(hNode, iField)

Field values:


7 Comment gives me the "Display Name" field not "Comment" field.

8 Cluster -Display correct

9 Equipment -Display correct

13 Target Page -Display correct

101 Returns both "Page" and Content" separated with a comma, i.e 'MyPage, My_FP' it does not display the Custom 1 field content.

Does anyone get the same results? 

Rune

  • Hi Rune,

    I am going to take a guess that you are calling this function on the workspace equipment model (tree) nodes ?
    What you have listed matches identically with how we load your equipment model up and store it in a menu structure.
    See _Equipment_LoadTask in SA_Include\EquipmentModel.ci and look for the labels beginning with MENU_PROP_. (The include project now has labels for all of those props so you don't have to remember the numbers)

    The "menu system" in Citect is quite a useful beast as it allows us to store hierarchical structures and use the fields as we wish. When we load the equipment model up and store it in a menu tree for fast access, we place the 'display name' in the comment field. The tree has the ability to dynamically switch between equipment name and its display name.
    We also load all the content associated with equipment's configuration into the Custom 1 field.

    cheers,

    bradley
  • Hi Bradley,
    Thanks for the clarification.

    You mention: The tree has the ability to dynamically switch between equipment name and its display name.

    In order to utilize this feature do we need to break into the default cicode or have you already made handles that can be tied into i.e. a customized button?

    Thanks,
    Rune
  • Hi Rune,

    It's a bit hidden... we forgot to expose it as a function.

    Try this, put a button on the Alarm page of the ExampleSA project.

    In the command, enter these two lines of code:

    DspSetMetadataFromName("EquipmentTree.Properties", "UseDisplayNames", "TRUE")
    PageSetInt("__TreeviewPos_" + IntToStr(DspGetAnFromName("EquipmentTree")) + "_Refresh", 1);

    At runtime when you press the button it will switch the tree into using the text from the "Display Name" field of your equipment.

    If you want to switch back, write "FALSE" to that metadata.

    How it works.
    The treeview genie on the Alarm Page has an AN name of "EquipmentTree". It has a hidden rectangle as one of its child objects called "Properties". You can see this if you open the DefaultAlarm_HD1080 page, select the treeview genie and press CTRL+G.
    From the Goto object dialog, if you open the properties up of this "Properties" rectangle object, you can then browse the metadata tab. You will see a number of metadata, of which one is "UseDisplayNames". We expose this via the genie form but not via a cicode function.

    The treeview code, however, was written expecting this to be dynamic at runtime, you'll see that in the "_Treeview_UpdateNodes" function.

    The "PageSetInt" command is how we "force" a refresh of the treeview control. Ideally we should have had a function for this... but at least you can enable this capability without modifying the treeview itself!

    cheers,

    bradley
  • This is great Bradley!
    Thanks a lot,
    Have a nice weekend!

    Rune