Applies To:
  • CitectSCADA 6.00, 6.00 Service Pack A, 6.10
  • CitectHMI 6.00, 6.00 Service Pack A, 6.10

Summary:
As a result of code changes for CitectSCADA v6.0, the function CSV_Nav_DisplayMenuBar() does
not function correctly in any of the following situations:

1. When the menubar is pasted at a different position on the page (i.e. other than x=2,y=25)
- the popup menu appears at the wrong location

2. When x,y coordinates are specified
- coordinates are ignored

3. When more than one menubar is pasted on a page
- only one menubar appears
 

Solution:
To fix these problems please replace the functions “CSV_Nav_DisplayMenuBar” and “_CSV_Nav_DisplayMenuBar” with the following (tried and tested) code:


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME
//                 CSV_Nav_DisplayMenuBar()
//
// REV DATE WHO DESCRIPTION
// 0 11/03/03 J.Venz Original
//
// GENERAL DESCRIPTION
//
//     Create menu bar for specified page.
//
//     The menu.dbf is accessed to determine what buttons should appear in the menu bar.
//     A new menu bar (ActiveX object) is created with the specified buttons.
//
// ARGUMENTS:
//
//     sPageName - Name of page
//     iX - x coordinate of top left corner of menu bar
//     iY - y coordinate of top left corner of menu bar
//     nBackColour - background colour of menu bar (citect palette number)
//     nForeColour - foreground (font) colour of menu bar (citect palette number)
//
// RETURNED VALUE:
//
//     0 if successful, otherwise -1.
//
// PSEUDO CODE:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

INT
FUNCTION

CSV_Nav_DisplayMenuBar(
STRING sPageName = "", INT iX = -1, INT iY = -1, INT
nBackColour = Transparent,
INT nForeColour = Transparent)

    IF sPageName = "" THEN
        sPageName = msGenericPageName;
    END

    IF nBackColour = Transparent THEN
        IF miMenuBackColour = Transparent THEN
            miMenuBackColour =
StrToInt(ParameterGet("Navigation","MenuBackColour",MakeCitectColour(244,234,223)));
        END

        nBackColour = miMenuBackColour;
    END

    IF nForeColour = Transparent THEN
        IF miMenuForeColour = Transparent THEN
            miMenuForeColour =
StrToInt(ParameterGet("Navigation","MenuForeColour",MakeCitectColour(0,64,128)));
        END

        nForeColour = miMenuForeColour;
    END

    _CSV_Nav_DisplayMenuBar(iX, iY, sPageName, nBackColour, nForeColour);

    RETURN 0;

END


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME
//                 _CSV_Nav_DisplayMenuBar()
//
// REV DATE WHO DESCRIPTION
// 0 11/03/03 J.Venz Original
//
// GENERAL DESCRIPTION
//
//     Create menu bar for specified page.
//
//     The menu.dbf is accessed to determine what buttons should appear in the menu bar.
//     A new menu bar (ActiveX object) is created with the specified buttons.
//
// ARGUMENTS:
//
//     iX - x coordinate of top left corner of menu bar
//     iY - y coordinate of top left corner of menu bar
//     sPageName - Name of page
//     nBackColour - background colour of menu bar (citect palette number)
//     nForeColour - foreground (font) colour of menu bar (citect palette number)
//
// RETURNED VALUE:
//
//     0 if successful, otherwise -1.
//
// PSEUDO CODE:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

INT
FUNCTION

_CSV_Nav_DisplayMenuBar(
INT iX, INT iY, STRING sPageName, INT nBackColour, INT nForeColour, INT iMenuAn = -1)

    INT bReady = 0;
    INT iError;
    INT iBackColour;
    INT iForeColour;
    STRING sMenuText;
    IsError();
    ErrSet(1);

    WHILE (bReady = 0) DO
        bReady =
PageInfo(25);
        SleepMS(100);
    END

    OBJECT objMenuBar;

    IF (iX <> -1 AND iY <> -1) OR iMenuAn <> -1 THEN

        IF iMenuAn = -1 THEN 
            iMenuAn =
DspAnNew(iX, iY + 25);
        END

        IF iMenuAn <> -1 THEN
            objMenuBar =
DspAnCreateControlObject(iMenuAn, msMenuBarClass, 1000, 25, "CSV_Nav_MenuBar");
            iError =
IsError();
        ELSE
            iError = -
1;
        END
    ELSE
        objMenuBar =
ObjectByName("CSV_Nav_MenuBar");
        iMenuAn =
AnByName("CSV_Nav_MenuBar");
        iX = DspGetAnLeft(iMenuAn);
        iY = DspGetAnTop(iMenuAn);
    END

    iError = IsError();

    IF NOT iError THEN
        sPageName = _CSV_Nav_CheckPageName(sPageName);
        sMenuText = _CSV_Nav_GetMenuButtons(sPageName);

        IF CSV_WinUtl_GetColourRes() = 0 THEN
            ! 256 Colour Mode -> ActiveX object displays dithered colours (Microsoft bug)
            iBackColour =
0x80000005; ! White
        ELSE
            iBackColour =
CitectColourToPackedRGB(nBackColour);
        END

        iForeColour = CitectColourToPackedRGB(nForeColour);
        _ObjectSetProperty(objMenuBar,
"BackColor",iBackColour);
        _ObjectSetProperty(objMenuBar,
"ForeColor",iForeColour);
        _ObjectCallMethod(objMenuBar,
"Display",iX, iY, sPageName, sMenuText);
    END
    ErrSet(0);

    RETURN iError;

END

 

Keywords:
popup menu, sub menu, menu, menubar, displaced  

Attachments