Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Menü falsche spalte/zeile (https://www.delphipraxis.net/88113-menue-falsche-spalte-zeile.html)

EWeiss 10. Mär 2007 11:24


Menü falsche spalte/zeile
 
Liste der Anhänge anzeigen (Anzahl: 1)
Menü eintrag liegt in der falschen spalte
Wie kann ich das ändern ?

Es geht um das Vismodule das soll weiter vorne liegen!
nicht im grauen bereich.

Bitte pic ansehen

gruss

TonyR 10. Mär 2007 11:45

Re: Menü falsche spalte/zeile
 
Irgendwie habe ich keine Ahnung, was das sein soll...
Hast du schon mal alle Eigenschaften dieses PopUps durchgesehen, ob da irgendwas verstellt ist?
Das sieht ja nicht aus wie das Standard-PopUp... was ist das für ein Ding?

Edit: das muss ja irgendwie daran liegen, dass es ein Untermenü hat... gibt es also irgendeine Einstellung für Untermenüs im PopUp?

EWeiss 10. Mär 2007 12:36

Re: Menü falsche spalte/zeile
 
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:

Zitat von TonyR
Irgendwie habe ich keine Ahnung, was das sein soll...
Hast du schon mal alle Eigenschaften dieses PopUps durchgesehen, ob da irgendwas verstellt ist?
Das sieht ja nicht aus wie das Standard-PopUp... was ist das für ein Ding?

Edit: das muss ja irgendwie daran liegen, dass es ein Untermenü hat... gibt es also irgendeine Einstellung für Untermenüs im PopUp?

Ja ist ein ownerdraw.

Hat aber nichts damit zu tun das Vismodule nicht direkt unter Preferences steht.
Und darum geht es mir ja.

Dachte das man wie in VB den eintag um eins nach rechts schieben kann damit es unter Prefences steht und nicht zuweit links.

begin
EDIT:

hab noch ein PIc mit angehängt wie es original ausschaut.
end EDIT:

begin
EDIT2:


Hier ist die procedure ...
Scheint das da ein eintrag für das Submenüitem fehlt.
Leider ist diese nicht von mir daher weiss ich nicht was da fehlen könnte.

Delphi-Quellcode:
procedure TVisForm.AdvDrawMenuItem(Sender: TObject; ACanvas: TCanvas;
  ARect: TRect; State: TOwnerDrawState);
var
  mi: TMenuItem;
  r: TRect;
  bm: TBitmap;
begin
  mi := Sender as TMenuItem;

  with ACanvas do
  begin
    Brush.Color := clWindow;
    FillRect(ARect);

    Brush.Color := clBtnFace;
    Windows.CopyRect(r, ARect);
    r.Right := 22;
    FillRect(r);
    if (odSelected in State) and (mi.Enabled) then
    begin
      Pen.Color := RGB(49,105,198);
      Brush.Color := RGB(198,211,239);
      Rectangle(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
    end;

    if mi.IsLine then
    begin
      MoveTo(ARect.Left+25, ARect.Top+(ARect.Bottom-ARect.Top) div 2);
      LineTo(ARect.Right, PenPos.Y);
      Exit; {return;}
    end;

    { Adjust rect for the glyph, and move it a bit if selected }
    r.Left := ARect.Left+4;
    r.Top := ARect.Top+3;
    if mi.Enabled and ((odSelected in State) or mi.Checked) then
      InflateRect(r, +1, +1);


    { Draw glyph from associated ImageList/Bitmap }
    if ((mi.ImageIndex >= 0) and (mi.GetImageList <> nil))
       or (not mi.Bitmap.Empty) then
    begin
      if mi.Checked then
      begin
        Pen.Color := RGB(49,105,198);
        Brush.Color := RGB(198,211,239);
        Rectangle(ARect.Left+1, ARect.Top+1, ARect.Left-1+22, ARect.Bottom-1);
      end;
      { Draw glyph stored in Bitmap property... }
      if not mi.Bitmap.Empty then
        Draw(r.Left, r.Top, mi.Bitmap)
      else
        mi.GetImageList.Draw(ACanvas, r.Left, r.Top, mi.ImageIndex, mi.Enabled);
    end;

    if mi.Checked and (mi.ImageIndex < 0) then
    begin
      bm := TBitmap.Create;
      bm.Handle := LoadBitmap(0, PChar(OBM_CHECK));
      Pen.Color := RGB(49,105,198);
      Brush.Color := RGB(198,211,239);
      Rectangle(ARect.Left+1, ARect.Top+1, ARect.Left-1+22, ARect.Bottom-1);
      Draw(ARect.Left+5, ARect.Top+3, bm);
      bm.Destroy;
    end;

    { Draw menu item text }
    Windows.CopyRect(r, ARect);
    r.Left := 25;
    InflateRect(r, -2, -2);

    Brush.Color := clMenu;
    SetBkMode(Handle, TRANSPARENT);
    if odSelected in State then
      SetBkColor(Handle, RGB(198,211,239))
    else
      SetBkColor(Handle, GetSysColor(COLOR_WINDOW));
    if mi.Enabled then
      Font.Color := clMenuText
    else
      Font.Color := clGrayText;
    if odNoAccel in State then
      DrawText(Handle, PChar(StripHotkey(mi.Caption)), -1, r,
        DT_SINGLELINE or DT_VCENTER)
    else
      DrawText(Handle, PChar(mi.Caption), -1, r, DT_SINGLELINE or DT_VCENTER);

    if mi.ShortCut <> 0 then
    begin
      r.Left := ARect.Right-TextWidth(ShortcutToText(mi.ShortCut))-5;
      DrawText(Handle, PChar(ShortcutToText(mi.ShortCut)), -1, r,
        DT_SINGLELINE or DT_VCENTER);
    end;

  end;
end;
end
EDIT2:


gruss

Muetze1 10. Mär 2007 13:36

Re: Menü falsche spalte/zeile
 
Sicher, das dem Menueintrag auch der Handler im Objektinspektor zugewiesen wurde? Also das OnAdvancedDrawItem auch bei dem besagten Menüeinträg zugewiesen wurde?

EWeiss 10. Mär 2007 13:42

Re: Menü falsche spalte/zeile
 
Zitat:

Zitat von Muetze1
Sicher, das dem Menueintrag auch der Handler im Objektinspektor zugewiesen wurde? Also das OnAdvancedDrawItem auch bei dem besagten Menüeinträg zugewiesen wurde?

Ups... das wars.
Klasse wieder ein problem beseitigt..
Fremde sprache schwere sprache :)

gruss Emil


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:24 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz