Einzelnen Beitrag anzeigen

jbg

Registriert seit: 12. Jun 2002
3.481 Beiträge
 
Delphi 10.1 Berlin Professional
 
#3

AW: TJvAppInstances Programmgesteuert weitere Instanzen zulassen

  Alt 28. Sep 2021, 16:26
TJvAppInstance bietet da direkt nichts an. Mit einem kleinen "Namenstrick" über der Formular/DataModule Deklaration kann man aber die Loaded Methode überschreiben und dort Active deaktivieren, wenn eine der Ctrl+Tasten gedrückt ist.

Delphi-Quellcode:
type
  TJvAppInstances = class(JvAppInst.TJvAppInstances) // same class name above the declaration to "trick" the compiler
  protected
    procedure Loaded; override;
  end;

  TFrmMain = class(TForm)
    JvAppInstances1: TJvAppInstances;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  FrmMain: TFrmMain;

implementation

{$R *.dfm}

{ TJvAppInstances }

procedure TJvAppInstances.Loaded;
begin
  Active := Active and (GetKeyState(VK_CONTROL) and $80 = 0);
  inherited Loaded;
end;
  Mit Zitat antworten Zitat