Ich habe ein TabControl aus der Rubrik Common Controls auf meinem Formular.
Dann habe ich eine Ereignis Procedure für OnChange geschrieben.
Wenn ich jetzt das Tab anklicke bzw. wechsele, dann wird auch ordnungsgemäß OnChange aufgerufen.
Aber wenn ich im Programm TabIndex setze, dann wird NICHT OnChange aufgerufen.
Es springt zwar oben der Reiter optisch um, aber OnChange wird nicht ausgeführt.
Siro
Code: Alles auswählen
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
TabControl1: TTabControl;
procedure Button1Click(Sender: TObject);
procedure TabControl1Change(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.TabControl1Change(Sender: TObject);
begin
caption:=IntToStr(TabControl1.TabIndex);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TabControl1.TabIndex:=2; // Reiter springt um, aber TabControl1Change wird NICHT aufgerufen
end;
end.