SDK Question Drawing MFD button labels on a 2d panel

markp

Member
Joined
Apr 14, 2008
Messages
309
Reaction score
6
Points
18
Location
Helsinki
Hi,

I am trying to add MFD buttons to an MFD on a 2d panel. I have the panel and MFD screen functioning and I also have some blank buttons displayed. However I can't seem to draw the labels for the MFD.

I am using the new 2d panel method that uses the letters stored elsewhere on the panel texture. I can draw letters of my own choice on the panel fine. However the code needs to know what the MFD labels are to draw those and I can't seem to grab the default MFD button label strings because oapiMFDButtonLabel is returning NULL all the time.

Any ideas what could be causing this problem? I've pretty much read all the posts, related to drawing MFD buttons, on the forum but just can't seem to get it working.

Thanks,
Mark
 

markp

Member
Joined
Apr 14, 2008
Messages
309
Reaction score
6
Points
18
Location
Helsinki
So I've been playing around with the code. Not luck so far. Have taken the panel and MFD related code out of my rather complicated vessel and put it in a simple bare bones vessel with very little code other than the panel and MFD code.

This is what it can produce. there are two blank buttons each side of the MFD. I have output the label string for buttons at the bottom of the screen in the debug string.

PanelMFDButtons.jpg

I have a couple of questions about the following code:

Code:
bool MFDButtonCol::Redraw2D (SURFHANDLE surf)
{

  int btn;
  const char *label;

  for (btn = 0; btn < 1; btn++) {
  label=oapiMFDButtonLabel(MFD_LEFT, btn);
  sprintf(oapiDebugString(),"button label %i %s",btn,label);
  oapiBlt (surf, surf, xcnt-120, lbly[btn]-200, 773, 22, 28, 12);
  }

  return false;
}

Any idea why oapiMFDButtonLabel is not finding the string for the button? Not sure why there are two buttons each side of the MFD.

Thanks,
Mark
 

markp

Member
Joined
Apr 14, 2008
Messages
309
Reaction score
6
Points
18
Location
Helsinki
OK I have the labels printing on the panel now.

I have actually based the code on Martin's blog entry but have been playing around with it quite a lot and forgot to change something back that I changed a while ago and forgot about. It was related to the region identifiers AID_MFD_LBUTTONS. Wont go into to the details. But will perhaps post the code for the whole vessel for people to compare. It's perhaps a little tricky getting it all working when new to virtual cockpits.

Just have to get the buttons to the correct size now.
 
Top