Bonjour tout le monde.

Purée ! J'applique pourtant un code qui m'a été fourni ici-même et qui marche très bien... habituellement.

Ce msg d'erreur :



Procédure appelante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
 
Procedure Appel_ITF_Choix_F_Cible;
Var   Retour_Question : integer;
 
begin
			// Ce code m'a été fourni ici------------------
      Form2 := TForm2.Create(Application);
      Retour_Question := Form2.ShowModal;  
      Form2.Free;
      // --------------------------------------------
 
      if Retour_Question = mrOK then
          begin
                  Form1.Btn_Effacer.SetFocus;
                  Form1.Btn_Choix_F.Enabled := False;
                  F_Cible_Defini  := True;
          end
      Else
          begin
                  Form1.SetFocus;
                  F_Cible_Defini  := True;
          end;
 
end;
Plantage ici :



Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

procedure TCustomForm.SetActiveControl(Control: TWinControl);
begin
  if FActiveControl <> Control then
  begin
    if not ((Control = nil) or (Control <> Self) and
      (GetParentForm(Control) = Self) and ((csLoading in ComponentState) or
        Control.CanFocus)) then
      raise EInvalidOperation.Create(SCannotFocus);   << ICI 
    FActiveControl := Control;
    if not (csLoading in ComponentState) then
    begin
      if FActive then SetWindowFocus;
      ActiveChanged;
    end;
  end;
end;


Que la Form2 soit visible ou pas (en principe elle ne doit pas l'être), ça foire !!

Qu'est-ce que j'ai encore fait ? J'applique systématiquement le même code d'appel, pour mes ShowModal, comme dit plus haut. 

Merci :(