CBuilder TMenu showing in wrong place

125 Views Asked by At

I have a Form that needs to be embedded in another Form. I'm placing on TCard:

EmbeddedForm->Parent = ACard;
EmbeddedForm->BorderStyle = bsNone;
EmbeddedForm->Align = alClient;
EmbeddedForm->Show();

All is working well, except that menus on the EmbeddedForm are offset to where they would be if the form were located in top left of the screen. To be clear, the menu shows up in the proper place on the EmbeddedForm, but when clicked, the sub-menu is in the wrong place.

I've tried modifying the DrawItem event, but so far I can't call the base class DrawItem() as it's protected:

void __fastcall TEmbeddedForm::File1DrawItem(TObject *Sender, TCanvas *ACanvas, TRect &ARect, bool Selected)
{
    ARect.Left = MainMenu1.Left;  // or some other calculation, not important yet
    ARect.Top = MainMenu1.Top;

    // ??? how to do normal drawItem from here?
}

I'm thinking, either I have to draw it myself (I don't want to) or somehow explain to TMainMenu where it's actually located (preferred solution).

0

There are 0 best solutions below