AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi Einem Event zugewiesene Ereignisprozedur ermitteln?
Thema durchsuchen
Ansicht
Themen-Optionen

Einem Event zugewiesene Ereignisprozedur ermitteln?

Ein Thema von freejay · begonnen am 3. Feb 2010 · letzter Beitrag vom 3. Feb 2010
Antwort Antwort
Seite 2 von 2     12   
Benutzerbild von uligerhardt
uligerhardt

Registriert seit: 19. Aug 2004
Ort: Hof/Saale
1.735 Beiträge
 
Delphi 2007 Professional
 
#11

Re: Einem Event zugewiesene Ereignisprozedur ermitteln?

  Alt 3. Feb 2010, 16:27
Ich hab sowas ähnliches mal in der Art gelöst:
Delphi-Quellcode:
type
  TActionType = (atFileNew, atFileOpen, ...);
  TActionTypes = set of TActionType;

  TMyActions = record
  strict private
    FActions: array[TActionType] of TAction;
  private
    function GetAction(AType: TActionType): TAction;
  public
    procedure CreateActions(ATypes: TActionTypes); // Erstellt die gewünschten Aktionen
    property Actions[AType: TActionType]: TAction read GetAction; // Falls du von außen was mit der Aktion anstellen willst.
  end;

procedure TMyActions.CreateActions(ATypes: TActionTypes);
var
  t: TActionType;
begin
  for t in ATypes do
  begin
     FActions[t] := TAction.Create(...);
     // ...
  end;
end;

function TMyActions.GetAction(AType: TActionType): TAction;
begin
  Result := FActions[AType];
end;
Jetzt nur so aus dem Kopf hingeschustert. Vielleicht kannst du dir ja was rausziehen.
Uli Gerhardt
  Mit Zitat antworten Zitat
Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#12

Re: Einem Event zugewiesene Ereignisprozedur ermitteln?

  Alt 3. Feb 2010, 16:54
Zitat von freejay:
Natürlich könnte ich noch Konstanten für die Tags anlegen, aber das ist alles so umständlich...
Also wenn dir das schon zu umständlich ist...
Delphi-Quellcode:
const
  ACTION_CUT = $00;
  ACTION_COPY = $01;
  ACTION_PASTE = $02;
  ACTION_DELETE = $03;
  ACTION_SELECTALL = $04;
  ACTION_FIND = $05;
  ACTION_REPLACE = $06;
  ACTION_TOUPPERCASE = $07;
  ACTION_TOLOWERCASE = $08;

...

case Item.Tag of
  ACTION_CUT: DoSomeThing;
  ACTION_COPY: DoSomeThingElse;
  else DoSomethingOther;
end;
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.005 Beiträge
 
Delphi 2009 Professional
 
#13

Re: Einem Event zugewiesene Ereignisprozedur ermitteln?

  Alt 3. Feb 2010, 20:19
Zitat von freejay:
Sollte es eine einfachere Lösung geben zu einem bestehenden (Popup-) Menü Default-Funktionen hinzuzufügen bin ich ganz Ohr
TAction und TActionList gibt es schon seit Delphi 6 (oder 5?) - und läßt bei normalen Anwendungen kaum Wünsche offen - oder ist da der Haken, dass 'Default'-Funktionen damit nicht so einfach zugewiesen werden können?

Viele Grüße,

Michael
Michael Justin
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


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 19:29 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