Je ne sais pas comment mettre le zip du projet à votre disposition, mais était simplifié au maximum pour ne pas faire de parasite, je vous le mets en texte.
1. Le dfm
object Form1: TForm1
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Height = 375
Width = 651
Left = 0
Top = 0
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Caption = 'Label1'
Left = 176
Top = 40
Width = 31
Height = 13
end
object PageControl1: TPageControl
ActivePage = TabSheet1
TabOrder = 0
Left = 160
Top = 128
Width = 289
Height = 193
object TabSheet1: TTabSheet
Caption = 'TabSheet1'
OnShow = TabSheet1Show
object Button1: TButton
Caption = 'Button1'
TabOrder = 0
Visible = False
Left = 54
Top = 32
Width = 75
Height = 25
end
end
end
object Button2: TButton
Caption = 'Button2'
TabOrder = 1
Visible = False
Left = 472
Top = 64
Width = 75
Height = 25
OnClick = Button2Click
end
end
2. le code pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, System.ComponentModel, Borland.Vcl.StdCtrls, Borland.Vcl.ComCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Button1: TButton;
Label1: TLabel;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure TabSheet1Show(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Déclarations privées}
public
{ Déclarations publiques}
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.FormShow(Sender: TObject);
begin
Button1.Visible:=true;
Button2.Visible:=true;
end;
procedure TForm1.TabSheet1Show(Sender: TObject);
begin
Button1.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption:=booltostr(Button1.Visible);
end;
end.
PS1:
Le bouton2 sert à afficher la proprité visible du bouton 1 (cela donne -1 pour true($FFFF) alors que le bouton est invisible)
PS2:
rajouter des invalidate, des repaint, des refresh un peu partout et sur form tabsheet ou bouton n'y change rien
PS3: Dans le vrai programme (heu, logiciel? application? Je vais encore me faire engueuler moi) il y a plein de tabsheet et passer de l'un à l'autre fait que le bouton s'affiche correctement. Mais je n'ai pas réussi à le reproduire simplement dans le test joint.
PS4: Je peux faire un zip du projet pour Delphi 2005 mais je ne sais pas comment le poster.
Merci