AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Automatisierung

Ein Thema von EWeiss · begonnen am 4. Sep 2017 · letzter Beitrag vom 6. Sep 2017
Thema geschlossen
Seite 1 von 3  1 23      
EWeiss
(Gast)

n/a Beiträge
 
#1

Automatisierung

  Alt 4. Sep 2017, 19:07
Ich habe doch noch leichte Probleme mit dem Grund Menu.
Benötige da noch ein paar Ideen oder Hilfestellungen.

Es geht mir vor allem um die Automatisierung das Fenster dynamisch zu zerstören wenn es nicht mehr gebraucht wird.
Im Moment muss ich an vielen Positionen PopUpMenu.DestroyWindow aufrufen um das Fenster zu schließen.

Hat jemand eine Idee wie man das machen könnte das es dynamisch\Automatisiert abläuft oder es an nur einer stelle geschieht?
Wie macht das denn ein normales Menu denn da muss man nicht jedes Mal eine Funktion aufrufen welche das Fenster zerstört.

Alleine das erstellen ist schon aufwendig.
Hier mal der Code! (Nicht kopiert selbst erstellt) LOL!

Delphi-Quellcode:
procedure CreateMyPopUpMenu(WinHandle: HWND);
var
  PrivateFont: PWideChar;
begin
  PopUpMenu := CTRL_PopUpMenuCreate;
  PopUpMenu.Width := 215;
  PopUpMenu.Height := 366;
  PopUpMenu.SkinConfigFile := PWideChar(DefSkin);
  PopUpMenu.UseVistaCrystal := CheckCrystal.GetCheckButtonStatus(CheckCrystal.Handle);
  PopUpMenu.UseVistaBlur := CheckAeroBlur.GetCheckButtonStatus(CheckAeroBlur.Handle);
  PopUpMenu.SideBarCaption := 'KVideo Player';
  PopUpMenu.SideBarCaptionLeft := 5;
  PopUpMenu.SideBarCaptionTop := 245;

  gPMenu.hPopUpHandle := PopUpMenu.CreatePopUpMenu(MainHandle);
  if gPMenu.hPopUpHandle <> 0 then
  begin
    AddPopUpControls(gPMenu.hPopUpHandle);

    PrivateFont := PWideChar(SKAERO_FOLDER + 'Menu\SideBar.ttf');
    PopUpMenu.FontName := 'Nasalization Free';
    PopUpMenu.FontSize := 14;
    PopUpMenu.CreatePrivateFont(PrivateFont);

    gPMenu.PopUpMenu := gPMenu.hPopUpHandle;
    gPMenu.bPopupMenu := True;
  end;
end;
Delphi-Quellcode:
procedure AddPopUpControls(WinHandle: HWND);
var
  ImagePathSid: WideString;
  ImagePathSel: WideString;
  ImagePathSep: WideString;
  IconPath: WideString;
  IconArrowPath: WideString;
  Enabled: BOOL;
  Color: COLORREF;
begin
  // Icon Pfade
  ImagePathSel := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Select.png';
  ImagePathSep := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Seperator.png';
  ImagePathSid := SKAERO_CONFIG_GetSkinFolder + 'Menu\SideBar.png';
  IconArrowPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\Arrow.ico';

  // Aktiven Status prüfen und Farbe zuweisen
  Enabled := (KVideo_GetPlayerState <> psNotReady);
  if Enabled then
     Color := SKAERO_POPMENUHILITE
  else
  Color := $FF737373;

  // SeitenBar
  PopUpMenu.AddSideBar(WinHandle, IDM_SIDEBARFRAME, ImagePathSid,
    2, 2, 21, 362, 0, false, true);

  // About
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_About.ico';
  PopUpMenu.AddButton(WinHandle, IDM_ABOUT, ImagePathSel, IconPath, 'About',
    24, 2, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20,
    'Oops...' + CHR(13) + 'Are they in the wrong place?');

  // Seperator
  PopUpMenu.AddButton(WinHandle, IDM_SEPERATOR, ImagePathSep, '', '-Appearance-',
    24, 22, 189, 20, SKAERO_ACTIVECAPTION, 1, 0, Center, 20, '',false);

  // Skins
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SkinFolder.ico';
  PopUpMenu.AddButton(WinHandle, IDM_SKIN, ImagePathSel, IconPath, 'Skins',
    24, 42, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20, '', true, IconArrowPath);

  // Seperator
  PopUpMenu.AddButton(WinHandle, IDM_SEPERATOR1, ImagePathSep, '', '-VideoFilter-',
    24, 62, 189, 20, SKAERO_ACTIVECAPTION, 1, 0, Center, 20, '', false);

  // Filter
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
  PopUpMenu.AddButton(WinHandle, IDM_FILTER, ImagePathSel, IconPath, 'Filter',
    24, 82, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20, '', true, IconArrowPath);

  // LAV Filter Configuration
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
  PopUpMenu.AddButton(WinHandle, IDM_LAVFILTERCONFIG, ImagePathSel, IconPath,
    'LAV Filter Configuration', 24, 102, 189, 20, Color, 1, 0, Left, 20, '', Enabled,
    IconArrowPath);

  // Seperator
  PopUpMenu.AddButton(WinHandle, IDM_SEPERATOR2, ImagePathSep, '', '-File Dependencies-',
    24, 122, 189, 20, SKAERO_ACTIVECAPTION, 1, 0, Center, 20, '', false);

  // Add File
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_File.ico';
  PopUpMenu.AddButton(WinHandle, IDM_ADDFILE, ImagePathSel, IconPath, 'Add File',
    24, 142, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20, '');

  // Seperator
  PopUpMenu.AddButton(WinHandle, IDM_SEPERATOR3, ImagePathSep, '', '-Options-',
    24, 162, 189, 20, SKAERO_ACTIVECAPTION, 1, 0, Center, 20, '', false);

  // Settings
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Option.ico';
  PopUpMenu.AddButton(WinHandle, IDM_OPTION, ImagePathSel, IconPath, 'Settings',
    24, 182, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20, '', true, IconArrowPath);

  // SubTitle Config
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitlecfg.ico';
  PopUpMenu.AddButton(WinHandle, IDM_SUBTITLECONFIG, ImagePathSel, IconPath, 'SubTitle Config',
    24, 202, 189, 20, Color, 1, 0, Left, 20, '', Enabled);

  // Show MediaFile Property
  if (KVideo_MediaInfoServiceReady) then
  begin
    Enabled := True;
    Color := SKAERO_POPMENUHILITE;
  end else
  if not(KVideo_GetMediaProperty(aMediaProperty)) then
  begin
    Enabled := false;
    Color := $FF737373;
  end;
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Info.ico';
  PopUpMenu.AddButton(WinHandle, IDM_MEDIAFILEPROPERTYS, ImagePathSel, IconPath,
    'Show MediaFile Property', 24, 222, 189, 20, Color, 1, 0, Left, 20, '', Enabled);

  // Select Video Track
  if (aMediaProperty.NumVideoStream = 0) then
  begin
    Enabled := false;
    Color := $FF737373;
  end else
  begin
    Enabled := True;
    Color := SKAERO_POPMENUHILITE;
  end;
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Video.ico';
  PopUpMenu.AddButton(WinHandle, IDM_VIDEOSTREAM, ImagePathSel, IconPath, 'Select Video Track',
    24, 242, 189, 20, Color, 1, 0, Left, 20, '', Enabled, IconArrowPath);

  // Select Audio Track
  if (aMediaProperty.NumAudioStream = 0) then
  begin
    Enabled := false;
    Color := $FF737373;
  end else
  begin
    Enabled := True;
    Color := SKAERO_POPMENUHILITE;
  end;
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Audio.ico';
  PopUpMenu.AddButton(WinHandle, IDM_AUDIOSTREAM, ImagePathSel, IconPath, 'Select Audio Track',
    24, 262, 189, 20, Color, 1, 0, Left, 20, '', Enabled, IconArrowPath);

  // Select SubTitle Track
  if (aMediaProperty.NumSubTitleStream = 0) then
  begin
    Enabled := false;
    Color := $FF737373;
  end else
  begin
    Enabled := True;
    Color := SKAERO_POPMENUHILITE;
  end;
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitle.ico';
  PopUpMenu.AddButton(WinHandle, IDM_SUBTITLETRACK, ImagePathSel, IconPath,
    'Select SubTitle Track', 24, 282, 189, 20, Color, 1, 0, Left, 20, '', Enabled, IconArrowPath);

  // Chapter
  if (aMediaProperty.NumChapter = 0) then
  begin
    Enabled := false;
    Color := $FF737373;
  end else
  begin
    Enabled := True;
    Color := SKAERO_POPMENUHILITE;
  end;
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Chapter.ico';
  PopUpMenu.AddButton(WinHandle, IDM_CHAPTER, ImagePathSel, IconPath, 'Chapter',
    24, 302, 189, 20, Color, 1, 0, Left, 20, '', Enabled, IconArrowPath);

  // Seperator
  PopUpMenu.AddButton(WinHandle, IDM_SEPERATOR4, ImagePathSep, '', '-Application-',
    24, 322, 189, 20, SKAERO_ACTIVECAPTION, 1, 0, Center, 20, '', false);

  // Close
  IconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Close.ico';
  PopUpMenu.AddButton(WinHandle, IDM_CLOSE, ImagePathSel, IconPath, 'Close',
    24, 342, 189, 20, SKAERO_POPMENUHILITE, 1, 0, Left, 20, 'Bye, Bye');

end;
gruss
 
TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.070 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: Automatisierung

  Alt 5. Sep 2017, 09:48
Zeig doch mal die Stelle, wo du CreateMyPopupMenu aufrufst. (Ist es eigentlich gewollt, dass zwar WinHandle übergeben, aber auf das globale MainHandle zugegriffen wird?)
Ich nehme an, dass geschieht in der Botschaftsbehandlung für WM_RBUTTONDOWN bzw -UP?

Geändert von TiGü ( 5. Sep 2017 um 09:50 Uhr)
 
EWeiss
(Gast)

n/a Beiträge
 
#3

AW: Automatisierung

  Alt 5. Sep 2017, 10:04
Zeig doch mal die Stelle, wo du CreateMyPopupMenu aufrufst.
Ich nehme an, dass geschieht in der Botschaftsbehandlung für WM_RBUTTONDOWN bzw -UP?
Nicht ganz.

Main WinProc.
Delphi-Quellcode:
    WM_NCRBUTTONDOWN:
      begin
          if gPMenu.bPopupMenu then
          begin
            gPMenu.bPopupMenu := false;
            PopUpMenu.DestroyWindow;
          end;

          CreatePopupMenu(Prop.MainHandle);

          GetCursorPos(P);
          GetWindowRect(gPMenu.PopUpMenu, rc);
          ClientToScreen(gPMenu.PopUpMenu, P);

          PopUpMenu.MoveWindow(gPMenu.PopUpMenu, P.X, (P.Y - rc.Bottom), rc.Right,
            rc.Bottom);

          PopupMenu.Show;

          while GetMessage(_Msg, 0, 0, 0) do
          begin
            TranslateMessage(_Msg);
            DispatchMessage(_Msg);
          end;

          if OnExit then
            PostMessage(WinHandle, WM_DESTROY, 0, 0);
      end;
Delphi-Quellcode:
    WM_NCLBUTTONDOWN:
      begin
        IsMoving := true;
        if gPMenu.bPopupMenu then
        begin
          PopUpMenu.DestroyWindow;
          gPMenu.bPopupMenu := false;
        end;
      end;
MovieProc
Delphi-Quellcode:
    WM_RBUTTONDOWN:
      SendMessageW(Prop.MainHandle, WM_NCRBUTTONDOWN, wP, LP);

    WM_LBUTTONDOWN:
      SendMessageW(Prop.MainHandle, WM_NCLBUTTONDOWN, wP, LP);
Zitat:
(Ist es eigentlich gewollt, dass zwar WinHandle übergeben, aber auf das globale MainHandle zugegriffen wird?)
Wo siehst du das?


gruss
 
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#4

AW: Automatisierung

  Alt 5. Sep 2017, 10:09
Zitat:
(Ist es eigentlich gewollt, dass zwar WinHandle übergeben, aber auf das globale MainHandle zugegriffen wird?)
Wo siehst du das?
Delphi-Quellcode:
procedure CreateMyPopUpMenu(WinHandle: HWND);
begin
  // ...
  gPMenu.hPopUpHandle := PopUpMenu.CreatePopUpMenu(MainHandle);
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
 
EWeiss
(Gast)

n/a Beiträge
 
#5

AW: Automatisierung

  Alt 5. Sep 2017, 10:18
Zitat:
(Ist es eigentlich gewollt, dass zwar WinHandle übergeben, aber auf das globale MainHandle zugegriffen wird?)
Wo siehst du das?
Delphi-Quellcode:
procedure CreateMyPopUpMenu(WinHandle: HWND);
begin
  // ...
  gPMenu.hPopUpHandle := PopUpMenu.CreatePopUpMenu(MainHandle);
Ahh danke
Nein das soll nicht so sein habe es behoben. Danke
Auch in WM_NCRBUTTONDOWN:

gruss

Geändert von EWeiss ( 5. Sep 2017 um 10:22 Uhr)
 
Benutzerbild von Sherlock
Sherlock

Registriert seit: 10. Jan 2006
Ort: Offenbach
3.800 Beiträge
 
Delphi 12 Athens
 
#6

AW: Automatisierung

  Alt 5. Sep 2017, 14:34
Leicht OT: Codereviews sind schon geil! Wäre es nicht schön/sinnvoll ein entsprechendes Unterforum zu haben? ICh würde da auch ein bis zwei Dinge reinstellen können .

Sherlock
Oliver
Geändert von Sherlock (Morgen um 16:78 Uhr) Grund: Weil ich es kann
 
EWeiss
(Gast)

n/a Beiträge
 
#7

AW: Automatisierung

  Alt 5. Sep 2017, 15:10
Habe es jetzt erst mal noch etwas angepasst damit es sich mehr an das normale Menu orientiert.

Delphi-Quellcode:
procedure AppendMenu(WinHandle: HWND);
var
  Enabled: BOOL;
  Color: COLORREF;
begin

  // Aktiven Status prüfen und Farbe zuweisen
  Enabled := (KVideo_GetPlayerState <> psNotReady);
  if Enabled then
     Color := SKAERO_POPMENUHILITE
  else
  Color := $FF737373;

   if gPMenu.hPopUpHandle <> 0 then
  begin
    // About
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_About.ico';
    PopUpMenu.ItemToolTip := 'Oops...' + CHR(13) + 'Are they in the wrong place?';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 2;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_About, 'About');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 22;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR, '-Appearance-');

    // Skins
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SkinFolder.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 42;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_SKIN, 'Skins');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 62;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR1, '-VideoFilter-');

    // Filter
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 82;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_FILTER, 'Filter');

    // LAV Filter Configuration
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 102;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_LAVFILTERCONFIG, 'LAV Filter Configuration');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 122;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR2, '-File Dependencies-');

    // Add File
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_File.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 142;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_ADDFILE, 'Add File');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 162;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR3, '-Options-');

    // Settings
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Option.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 182;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_OPTION, 'Settings');

    // SubTitle Config
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitlecfg.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 202;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_SUBTITLECONFIG, 'SubTitle Config');

    // Show MediaFile Property
    if (KVideo_MediaInfoServiceReady) then
    begin
      if not(KVideo_GetMediaProperty(aMediaProperty)) then
      begin
        Enabled := false;
        Color := $FF737373;
      end else
      begin
        Enabled := True;
        Color := SKAERO_POPMENUHILITE;
      end;
    end else
    begin
      Enabled := false;
      Color := $FF737373;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Info.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 222;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_MEDIAFILEPROPERTYS, 'Show MediaFile Property');

    // Select Video Track
    if (aMediaProperty.NumVideoStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Video.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 242;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_VIDEOSTREAM, 'Select Video Track');

    // Select Audio Track
    if (aMediaProperty.NumAudioStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Audio.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 262;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_AUDIOSTREAM, 'Select Audio Track');

    // Select SubTitle Track
    if (aMediaProperty.NumSubTitleStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitle.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 282;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_SUBTITLETRACK, 'Select SubTitle Track');

    // Chapter
    if (aMediaProperty.NumChapter = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Chapter.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 302;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_CHAPTER, 'Chapter');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 322;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR4, '-Application-');

    // Close
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Close.ico';
    PopUpMenu.ItemToolTip := 'Bye, Bye';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 342;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_CLOSE, 'Close');
  end;

end;
gruss
 
bra

Registriert seit: 20. Jan 2015
711 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#8

AW: Automatisierung

  Alt 5. Sep 2017, 15:36
Wenn du die einzelnen Aufrufe in einer Funktion verpackst, schrumpft der Code um ein Vielfaches:

Code ist unvollständig und die Parameter müssen ggf. noch ergänzt werden.

Delphi-Quellcode:
procedure AppendEntry(APopUpMenu, AIconPath, AHiliteColor, ATextAlignment, AEnabled, ATop, ACaption);
begin
    APopUpMenu.ItemIconPath := AIconPath;
    APopUpMenu.ItemHiliteColor := AHiliteColor;
    APopUpMenu.ItemTextAlligment := ATextAlignment;
    APopUpMenu.ItemEnabled := AEnabled;
    APopUpMenu.ItemTop := ATop;
    APopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_CHAPTER, ACaption);
end;
 
EWeiss
(Gast)

n/a Beiträge
 
#9

AW: Automatisierung

  Alt 5. Sep 2017, 15:50
jo könnte man machen
Mache ich aber nicht weil der Kram dann total unleserlich wird.

gruss

Geändert von EWeiss ( 5. Sep 2017 um 15:56 Uhr)
 
bra

Registriert seit: 20. Jan 2015
711 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#10

AW: Automatisierung

  Alt 5. Sep 2017, 15:57
Stimmt, 10 Zeilen Code sind unleserlicher als 50 Zeilen mit immer den selben Aufrufen

Geändert von bra ( 5. Sep 2017 um 16:02 Uhr)
 
Thema geschlossen
Seite 1 von 3  1 23      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08: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