Einzelnen Beitrag anzeigen

stonimahoni

Registriert seit: 12. Okt 2004
146 Beiträge
 
Delphi 7 Professional
 
#15

Re: problem mit "menüanzeige"

  Alt 2. Nov 2004, 15:38
hab ez noch folgendes im netz gefunden :

Delphi-Quellcode:
Okay, this one is really beginning to bug me. Especially as it
should be really simple.

I have a button that is within a panel on a form. This form is
itself then embedded within the main form of the project at
run time. When this button is clicked I need to display a popup
menu aligned just beneath the button. No problem, I've done
this hundreds of times before using code similar to the
following:

var
APoint: TPoint;

APoint.X := Button.Left;
APoint.Y := Button.Top + Button.Height;
APoint := Panel.ClientToScreen(APoint);
PopupMenu.Popup(APoint.X, APoint.Y);

Except that the fact the form is embedded seems to be messing
up the ClientToScreen call and consequently the popup menu is
not appearing nicely under the button (it has the right Top
value, but the wrong Left value). I know I
'm missing something
simple here and I guess that is what is bugging me about it.

Delphi-Quellcode:
Don't worry guys, I've figured it out. Turns out that the
popup menu was wider than the button and given that the
button was sitting by the right edge of the panel/screen,
Windows was automatically adjusting the left position so
that the entire menu would appear on screen. Of course,
I'd forgotton that Windows does this.

Knew it had to be something simple :)

was soll ich damit anfangen ? *wargh*

plz help me
Carsten
  Mit Zitat antworten Zitat