Drop-down menu for MV point

Hello, there is an MV point with several states (state-1, state-2, state-3, etc.). Can someone tell me
How to make a drop-down menu to select these states?
A menu of the kind shown in the picture (taken from another SCADA, where this element is present directly on the toolbar)

  • You need to write cicode :) it's 2019 and there's no drop down menu component...

    Lookup dspPopupMenu I think it's called, in the help.
  • Здравствуйте Антон. Если вы имеете ввиду элемент ActiveX ciText.ComboBox, то у меня он отображает только текущее значение тэга, а при нажатии на кнопку выпадающего меню там оказывается пустой список. Велика вероятность что я просто не разобрался в настройках данного элемента. Вы не могли бы подробнее описать как его использовать?
  • щас нас забанят за разговоры на неанглийском )))
    можно ciText, но я про MS Forms.ComboBox - а с ним как с любым ActiveX элементом на CiCode - конкретно я только я ProcessAnalyst работал.... но свойства, методы можно легко нагуглить
  • список надо заполнять чем-то типа метода AddItem()
  • Dear Viktor and Anton, Can you keep the conversation in English please? So in the future people can reuse this as reference even if are not Russian speakers! Thanks
  • Unknown said:
    щас нас забанят за разговоры на неанглийском )))
    можно ciText, но я про MS Forms.ComboBox - а с ним как с любым ActiveX элементом на CiCode - конкретно я только я ProcessAnalyst работал.... но свойства, методы можно легко нагуглить

    MS Forms.ComboBox need license .... it works good if you have MS Office ....

  • You have to know an object model ciText.ComboBox and ->>

    _ObjectCallMethod

    Calls a specific method for an ActiveX object. (See the documentation for your ActiveX object for details on methods and properties.)

    Note: The parameter list passed to the control can only have Cicode variables or variable tags; it cannot use values returned directly from a function because an ActiveX control may modify parameters passed to it.

    For example:

    //Calculate a value and pass to ActiveX control
    _ObjectCallMethod(hControl, "DoSomething", CalcValue());

    is not allowed because the return value of a function cannot be modified. The following should be used instead:

    INT nMyValue;
    //Calculate Value
    nMyValue = CalcValue();
    //Pass Value to ActiveX control
    _ObjectCallMethod(hControl, "DoSomething", nMyValue);

    Syntax

    _ObjectCallMethod(hObject, sMethod, vParameters)

    hObject:

    The handle for the object (as returned by the ObjectByName() function).

    sMethod:

    The name of the method.

    vParameters:

    A variable length parameter list of method arguments. The variables will be passed however you enter them, and will then be coerced into appropriate automation types. Likewise, any values modified by the automation call will be written back - with appropriate coercion - into the passed Cicode variable.

    Return Value

    The return value from the method - if successful, otherwise an error code is returned.

  • https://www.citect.schneider-electric.com/webhelp/vijeo720/#../Subsystems/CicodeReferenceHTML/Content/_ObjectCallMethod.html
  • Q5085 How to create a combo box

    ArticleID: Q5085
    Created: 22/09/2008
    Last Updated: 22/09/2008
    Suggested By: Warwick Black

    Applies To:
    CitectSCADA 5.31, 5.40, 5.41, 5.42, 5.50, 6.0, 6.1, 7.0
    CitectHMI 5.31, 5.40, 5.41, 5.42, 5.50, 6.0, 6.1, 7.0
    CitectFacilities 5.31, 5.40, 5.41, 5.42, 5.50, 6.0, 6.1, 7.0
    CitectSCADA Batch 5.31, 5.40, 5.41, 5.42, 5.50, 6.0, 6.1, 7.0
    CitectSCADA Pocket 5.31, 5.40, 5.41, 5.42, 5.50, 6.0, 6.1, 7.0
     



    --------------------------------------------------------------------------------
    Summary:
    How do I create a combo box?

     

    Solution:
    There are 2 ways to do it, Use:


    * ActiveX combo box, or
    * ciText.combobox.
    To use an ActiveX combo box:


    Paste the activeX control “Microsoft Forms 2.0 ComboBox” on a graphics page
    Associate the TEXT property with a Tag. This tag will contain the value of the item selected from the ComboBox.


    FUNCTION MyPageLoad()
       OBJECT oComboBox1
       INT iIndex
       oComboBox1 = ObjectByName("AN210")
       _ObjectCallMethod(oComboBox1,"Clear")
       _ObjectCallMethod(oComboBox1,"AddItem","Tag1",iIndex)
       iIndex = iIndex + 1
       _ObjectCallMethod(oComboBox1,"AddItem","Tag2",iIndex)
       iIndex = iIndex + 1
       _ObjectCallMethod(oComboBox1,"AddItem","Tag3",iIndex)
    END

    FUNCTION MyPageLoad2()
       OBJECT oComboBox1
       INT iIndex
       oComboBox1 = ObjectByName("AN210")
       _ObjectCallMethod(oComboBox1,"Clear")
       _ObjectCallMethod(oComboBox1,"AddItem",Tag1,iIndex)
       iIndex = iIndex + 1
       _ObjectCallMethod(oComboBox1,"AddItem",Tag2,iIndex)
       iIndex = iIndex + 1
       _ObjectCallMethod(oComboBox1,"AddItem",Tag3,iIndex)
       iIndex = iIndex + 1
    END

    To use a ciText combo box:

    Use example project
    Paste the following function to Recipe.Ci file
    Configure a device using DBF file type (as we are using Example project, Recipe.dbf already exists)
    Insert CiText.ComboBox on a graphics page (Say page "Recipe")
    Find out the animation point occupied by this control
    Add a button on this page as well and call the following function in the command field LoadRecipe2ComboBox("AN35")
    Compile the project
    Run the project


    FUNCTION LoadRecipe2ComboBox(STRING sAN)
       STRING sName;
       OBJECT oComboBox1;
       INT iComboBoxIndex1 = 0;
       INT iRecNo;
       IF hRecipe < 0 THEN
          hRecipe = DevOpen("Recipes", 0);
       END
       IF hRecipe >= 0 THEN
          iRecNo = DevRecNo(hRecipe); !Current Record Number
          DevSeek(hRecipe, 1);
          oComboBox1 = ObjectByName(sAN);
          _ObjectCallMethod(oComboBox1, "Clear");
          WHILE NOT DevEOF(hRecipe) DO
             sName = DevGetField(hRecipe, "Name");
             _ObjectCallMethod(oComboBox1, "AddItem", sName,
             iComboBoxIndex1);
             iComboBoxIndex1 = iComboBoxIndex1 + 1;
             DevNext(hRecipe);
          END
          DevSeek(hRecipe, iRecNo); // Reinstate the original position
       ELSE
          Message("ComboBox", "Cannot Open Recipes.DBF device.", 0);
       END
    END

    If you want to use the function with other applications, you should modify it accordingly. For example, if you have more than one ComboBox on a page, you could code the function as generic one as shown below. Simply pass the device handle, animation point number and data field name. Note that you want the function to be call on page entry, you have to delay the call until the control is instantiated. In V6, a new page event called "On page shown" is introduced that guarantee all objects are instantiated. Hope this would help.


    FUNCTION LoadRecipe2ComboBox(INT hRecipe, STRING sAN, STRING sFieldName)
       STRING sName;
       OBJECT oComboBox1;
       INT iComboBoxIndex1 = 0;
       INT iRecNo;
       IF hRecipe >= 0 THEN
          iRecNo = DevRecNo(hRecipe); !Current Record Number
          DevSeek(hRecipe, 1);
          oComboBox1 = ObjectByName(sAN);
          _ObjectCallMethod(oComboBox1, "Clear");
          WHILE NOT DevEOF(hRecipe) DO
             sName = DevGetField(hRecipe, sFieldName);
             _ObjectCallMethod(oComboBox1, "AddItem", sName,
             iComboBoxIndex1);
             iComboBoxIndex1 = iComboBoxIndex1 + 1;
             DevNext(hRecipe);
          END
          DevSeek(hRecipe, iRecNo); // Reinstate the original position
       ELSE
          Message("ComboBox", "Cannot Open Recipes.DBF device.", 0);
       END
    END


    see the KB CitectSCADA KB 2013-05-28.chm