Einzelnen Beitrag anzeigen

jbg

Registriert seit: 12. Jun 2002
3.483 Beiträge
 
Delphi 10.1 Berlin Professional
 
#18
  Alt 12. Jun 2002, 12:54
Ich optimiere den Code noch einmal
Code:
procedure EnterTab(Sender: TObject; var Key: Word; Shift: TShiftState;
  ClassAus: array of TClass; ObjectAus: array of TObject;
  bESC_Close: Boolean = True);
var
  Mgs: TMsg;

  //_____________________________KAPSELUNG
  function ClassObjectAusschliessen: Boolean;
  var
    Index: Integer;
  begin
    Result := True;
    with Sender as TForm do
    begin
      for Index := Low(ClassAus) to High(ClassAus) do
        if ActiveControl is ClassAus[Index] then // Diese Classe ausschliessen
          Exit;
      for Index := Low(ObjectAus) to High(ObjectAus) do
        if ActiveControl = ObjectAus[Index] then // Dieses Object ausschliessen
          Exit;
    end;
    Result := False;
  end;

  //_______________________________HAUPTPROGRAMM
begin
  if Sender is TForm then
    with Sender as TForm do
    begin
      case Key of
        VK_RETURN, VK_TAB: if not ClassObjectAusschliessen then
        begin
          Key := 0;
          Perform(WM_NextDlgCtl, ord(Shift = [ssShift]), 0);
          PeekMessage(Mgs, 0, WM_CHAR, WM_CHAR, PM_REMOVE); // Beep-Ton ausschalten
        end;
        VK_ESCAPE: if bESC_Close and (Shift <> [ssShift]) then
        begin
          Key := 0;
          Close;
          PeekMessage(Mgs, 0, WM_CHAR, WM_CHAR, PM_REMOVE); // Beep-Ton ausschalten
        end;
      end // case
    end; // für WITH Sender As TForm DO
end;
Sag mal Paul Jr. was hast du für eine Delphi-Version, oder schreibst du jedesmal das procedure der EventHandler in PROCEDURE um?
  Mit Zitat antworten Zitat