IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

 Delphi Discussion :

Access Violation lors d'un CustomCreate (inherited)


Sujet :

Delphi

  1. #1
    Membre éprouvé
    Avatar de Aooka
    Homme Profil pro
    Scripting Powershell & Wlangage
    Inscrit en
    Juillet 2015
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Scripting Powershell & Wlangage

    Informations forums :
    Inscription : Juillet 2015
    Messages : 227
    Points : 1 095
    Points
    1 095
    Par défaut Access Violation lors d'un CustomCreate (inherited)
    Bonjour,

    J'ai écrit une fiche ce matin et impossible de comprendre la bêtise que j'ai faite : le programme plante lors du Inherited Create(Owner) donc dès le début du CustomCreate. Si quelqu'un a une idée..

    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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    unit uPanelImputation;
     
    interface
     
    uses
      {$IF DEFINED(ANDROID)}
        Androidapi.JNI.JavaTypes,FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText,
        Androidapi.JNIBridge,  Androidapi.Helpers,
      {$ENDIF}
     
      System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,System.IOUtils,
      FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
      FMX.Objects, FMX.Layouts, FMX.DateTimeCtrls, FMX.ListBox, FMX.TabControl,
      Data.DbxSqlite, Data.DB, Data.SqlExpr, Generics.Collections, System.Generics.Defaults,
      DateUtils, System.Generics.Collections, MenuParametres,
      DatabaseHelper, FMX.Controls.Presentation, PanelBC, FMX.Edit;
     
    type
     
      TBTNValidateClickDelegate = procedure(iCleBC : LongInt; sRef : String) Of Object;
     
      TPanelImput = class(TPanel)
     
        PanelWhite : TPanel;
     
        VSB : TVertScrollBox;
     
        Img : TImage;
     
        BTN_Exit : TButton;
     
        Edit_Imput1 : TEdit ; // chantier (BDD : ba_dbc)
        Edit_Imput2 : TEdit ; // travail  (..idem..)
     
        LBL_I1 : TLabel ; // Imput1
        LBL_I2 : TLabel ; // Imput2
     
        BTN_Validate : TButton ;
     
     
        procedure BTNValidateClick(Sender : TObject);
        procedure OnBTNExitClick(Sender : TObject);
        procedure OnResizePanelBlack(Sender : TObject);
        procedure VSBResize(Sender : TObject);
     
      private
     
        F_sNomPackageAndroid, F_sCheminBddWindows : String;
     
        BTNValidateClickDelegate : TBTNValidateClickDelegate;
     
        F_iCleBC : LongInt;
        F_sReference : String;
     
        F_sImput1 , F_sImput2 : String;
     
      public
     
        constructor CustomCreate(Owner : TComponent; iCleBC : LongInt; sRef : String);
     
        property OnBTNValidateIClick : TBTNValidateClickDelegate write BTNValidateClickDelegate;     // I comme Imput
     
        property readiCleBC : LongInt read F_iCleBC;
        property readImput1 : String read F_sImput1;
        property readImput2 : String read F_sImput2;
    end;
     
    implementation
     
    constructor TPanelImput.CustomCreate(Owner : TComponent; iCleBC : LongInt; sRef : String);
    var
      sCheminVersImage : String;
     
    {$IF DEFINED(ANDROID)}
      PackageManager: JPackageManager;
      PackageInfo : JPackageInfo;
    {$ENDIF}
    begin
      Inherited Create(Owner); /* blop sa pique ici */
     
      F_iCleBC := iCleBC;
     
      F_sNomPackageAndroid := '';
      F_sCheminBddWindows := '.\blop\';
     
      {$IF DEFINED(ANDROID)}
        PackageManager := SharedActivity.getPackageManager;
        F_sNomPackageAndroid := JStringToString(PackageInfo.packageName);
        sCheminVersImage := '/blop/' + F_sNomPackageAndroid + '/blup/';
      {$ELSE}
        sCheminVersImage := '.\blop\';
      {$ENDIF}
     
      Parent := Owner As TFmxObject;
     
      StyleLookup := 'styleblack';
      Visible := True;
      OnResize := OnResizePanelBlack;
     
      PanelWhite := TPanel.Create(Self);
      with PanelWhite do
      Begin
        Parent := Self;
        StyleLookup := 'stylewhite';
        Align := TAlignLayout.Center;
        Visible := True;
        Width := Self.Width * 0.6;
        Height := Self.Height * 0.6;
      End;
     
      VSB := TVertScrollBox.Create(PanelWhite);
      With VSB do
      Begin
        Parent := PanelWhite;
        Align := TAlignLayout.Client;
        OnResize := VSBResize;
      End;
     
      Img := TImage.Create(VSB);
      With Img do
      Begin
        Parent := VSB;
        OnClick := OnBTNExitClick;
      End;
     
      if Tfile.Exists(sCheminVersImage + 'bloop') then
        Img.Bitmap.LoadFromFile(sCheminVersImage + 'bloop');
     
      Edit_Imput1 := TEdit.Create(VSB);
      With Edit_Imput1 do
      Begin
        Parent := VSB;
        Position.X := 10;
        Position.Y := Img.Position.Y + Img.Height * 2;
        Width := Round((Self.Width - 30) / 2);
      End;
      LBL_I1 := TLabel.Create(VSB);
      With LBL_I1 do
      Begin
        Parent := VSB;
        Position.X := Edit_Imput1.Position.X + Edit_Imput1.Width - 10;
        Position.Y := Edit_Imput1.Position.Y;
        Width := Round((Self.Width - 30) / 2);
      End;
     
      Edit_Imput2 := TEdit.Create(VSB);
      With Edit_Imput2 do
      Begin
        Parent := VSB;
        Position.X := Edit_Imput1.Position.X;
        Position.Y := Edit_Imput1.Position.Y + Edit_Imput1.Height * 2;
        Width := Round((Self.Width - 30) / 2);
      End;
      LBL_I2 := TLabel.Create(Self);
      With LBL_I2 do
      Begin
        Parent := VSB;
        Position.X := Edit_Imput2.Position.X + Edit_Imput2.Width - 10;
        Position.Y := Edit_Imput1.Position.Y;
        Width := Round((Self.Width - 30) / 2);
      End;
    end;
     
    procedure TPanelImput.BTNValidateClick(Sender : TObject);
    begin
      if Assigned(BTNValidateClickDelegate) then
        BTNValidateClickDelegate(F_iCleBC , F_sReference);
    end;
     
    procedure TPanelImput.OnBTNExitClick(Sender : TObject);
    Begin
      Img.Free;
      PanelWhite.Free;
      Self.Free;
    End;
     
    procedure TPanelImput.OnResizePanelBlack(Sender : TObject);
    Begin
      PanelWhite.Width := Self.Width * 0.6;
      PanelWhite.Height := Self.Height * 0.6;
    End;
     
    procedure TPanelImput.VSBResize(Sender : TObject);
    begin
      With Img do
      Begin
        Width := 20;
        Height := 20;
        Position.Y := 10;
        Position.X := VSB.Width - Width - 10;
      End;
    end;
     
     
    end.
    Merci,

  2. #2
    Membre éprouvé
    Avatar de Aooka
    Homme Profil pro
    Scripting Powershell & Wlangage
    Inscrit en
    Juillet 2015
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Scripting Powershell & Wlangage

    Informations forums :
    Inscription : Juillet 2015
    Messages : 227
    Points : 1 095
    Points
    1 095
    Par défaut
    La bêtise de la journée : (venait dans une autre forme, celle qui appelait cette unité..)

    Erreur :
    F_PanelImput.CustomCreate(Self, iCleBC, sRef);
    Réponse :
    F_PanelImput := TPanelImput.CustomCreate(Self, iCleBC, sRef);
    Désolé, le post peut même être supprimé par un admin s'il est vu comme inutile se que je comprendrais bien

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Access Violation lors de la fermeture d'une application
    Par Jean-Jacques Engels dans le forum EDI
    Réponses: 1
    Dernier message: 22/06/2011, 12h33
  2. Accesse Violation lors de lecture d'une vidéo
    Par jad777 dans le forum C++Builder
    Réponses: 9
    Dernier message: 23/10/2008, 00h14
  3. Access violation lors d'une exécution
    Par demonia dans le forum C++
    Réponses: 1
    Dernier message: 26/11/2007, 23h29
  4. Réponses: 4
    Dernier message: 01/01/2007, 21h09
  5. Réponses: 7
    Dernier message: 22/02/2005, 13h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo