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. |
Partager