SDK Question MFD Button Labels for USER MFD's

tuanbusku

New member
Joined
May 18, 2018
Messages
1
Reaction score
0
Points
0
I have been an Orbiter fan for a long time and am working very seriously now on my own .dll based ship. I am working specifically on a very wide panel (1920 pixels) and have room for at least 3 or maybe even 4 MFD's while realizing that there may be frame rate problems. I have all the MFD buttons working fine but I cannot get the button labels working in the additional MFD.

I am sure that I must be missing something very simple but I am really stumped on this one. From what I can determine the maximum number of MFD's permitted is actually 10 - left, right and eight additional user defined called USER1 - USER8. However, when I try to setup an additional MFD based on this everything works fine except for the button menus. I don't get any text output anywhere for the additional MFD.

I know the code works because I get the button menus for the left and right MFD's. This code was borrowed from DG with only a few modifications

Code:
void Special::RedrawPanel_MFDButton(SURFHANDLE surf, int mfd, int side)
{
    HDC hDC = oapiGetDC(surf);
    SelectObject(hDC, g_Param.hFont[0]);
    SetTextColor(hDC, RGB(196, 196, 196));
    SetTextAlign(hDC, TA_CENTER);
    SetBkMode(hDC, TRANSPARENT);
    const char *label;
    int x = 13;
    int y = 3;

    for (int bt = 0; bt < 6; bt++) {
        if (label = oapiMFDButtonLabel(mfd, bt + side * 6)) {
            TextOut(hDC, x, y, label, strlen(label));
            y += 41;
        }
        else break;
    }
    oapiReleaseDC(surf, hDC);
}

And the associated calling functions

Code:
case AID_MFD3_LBUTTONS:
    RedrawPanel_MFDButton(surf, MFD_USER1, 0);
    return true;
case AID_MFD3_RBUTTONS:
    RedrawPanel_MFDButton(surf, MFD_USER1, 1);
    return true;

Any ideas? Do I need to do something special for a USER MFD?

Thanks to all in advance.
 
Last edited by a moderator:
Top